[PATCH] Fix 53360 - String leak in DCOPClient

Luis Pedro Coelho luis_pedro at netcabo.pt
Sun Mar 9 00:27:27 GMT 2003


Le Dimanche 9 Mars 2003 01:14, Waldo Bastian a écrit :
> > +    free(vendor);
> > +    free(release);
>
> should be if (vendor) free(vendor); because free doesn't like to free 0
> pointers, unlike delete.

My free() says he does (from man 3 free, note last sentence):

       free() frees the memory space pointed to by ptr, which must  have  been
       returned by a previous call to malloc(), calloc() or realloc().  Other-
       wise, or  if  free(ptr)  has  already  been  called  before,  undefined
       behaviour occurs.  If ptr is NULL, no operation is performed.

But maybe other people's free()s are not so forgiving and we should code for 
them. Btw, this is linux rh 8.0.

Ok to commit my patch with your modifications? 

Regards
-- 
Luis Pedro Coelho

"Technology does not always equal progress."
Douglas Coupland




More information about the kde-core-devel mailing list