Mailing List Archive

vpnc-nortel memory leak
Hi,

When call the asprintf , I failed to notice a matching call to free.
Please view the patch.


Sincerely Yours,

Bin Li

http://cn.opensuse.org
Re: vpnc-nortel memory leak [ In reply to ]
Ciao Ben Li,

you are right, I introduced a memory leak.
Will commit your patch in svn asap.

Best Regards,
Antonio Borneo

On Wed, Oct 14, 2009 at 5:36 PM, Bin Li <libin.charles@gmail.com> wrote:
> Hi,
>
> When call the asprintf , I failed to notice a matching call to free.
> Please view the patch.
>
>
> Sincerely Yours,
>
> Bin Li
>
> http://cn.opensuse.org
_______________________________________________
vpnc-devel mailing list
vpnc-devel@unix-ag.uni-kl.de
https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel
http://www.unix-ag.uni-kl.de/~massar/vpnc/
Re: vpnc-nortel memory leak [ In reply to ]
Patch committed as 447.

I have removed the proposed check for NULL pointer, since this is not correct.
Man-page for asprintf reports:
int asprintf(char **strp, const char *fmt, ...);
...
RETURN VALUE
When successful, these functions return the number of bytes
printed, just like sprintf(3). If memory
allocation wasn’t possible, or some other error occurs, these
functions will return -1, and the con-
tents of strp is undefined.

vpnc uses asprintf in several points, and never checks return value.

Should we enforce the whole code agains allocation error?
Why not using a wrap around these memory functions, as "wget" code do
with xmalloc() (see file wget-1.12/lib/xmalloc.c) ?

Best Regards,
Antonio Borneo

On Sat, Oct 17, 2009 at 12:35 AM, Antonio Borneo
<borneo.antonio@gmail.com> wrote:
> Ciao Ben Li,
>
> you are right, I introduced a memory leak.
> Will commit your patch in svn asap.
>
> Best Regards,
> Antonio Borneo
>
> On Wed, Oct 14, 2009 at 5:36 PM, Bin Li <libin.charles@gmail.com> wrote:
>> Hi,
>>
>> When call the asprintf , I failed to notice a matching call to free.
>> Please view the patch.
>>
>>
>> Sincerely Yours,
>>
>> Bin Li
>>
>> http://cn.opensuse.org
>

_______________________________________________
vpnc-devel mailing list
vpnc-devel@unix-ag.uni-kl.de
https://lists.unix-ag.uni-kl.de/mailman/listinfo/vpnc-devel
http://www.unix-ag.uni-kl.de/~massar/vpnc/