Calls to realloc-type functions in Wine...

Lionel_Debroux lionel_debroux at yahoo.fr
Sat Dec 22 04:30:05 CST 2007


Hi everybody,

One of the patches I sent on December 9th contained a fix for two
constructs of the form
ptr = msi_realloc (ptr, newsize);
I spotted these constructs while investigating on unrelated "potential
leak" entries of Michael Stefaniuc's list of potential issues found by
Smatch.

It's very unlikely that *realloc fails, but if it does, this leaks some
memory (or may fault, if the code is not protected against *realloc
returning NULL).

Last week, I spotted another construct of that form.
That prompted me to make a case-insensitive search of "realloc" in the
whole Wine tree. Such a simple search was bound to turn a significant
amount of noise (comments, TRACE/WARN, even correct uses of realloc,
etc.), but it would also reveal other (probably) incorrect uses of
realloc-type functions.


The sorted and hand-filtered results of the search I made December 14th
are attached. I didn't update the file before writing this mail because
it didn't make much sense: this kind of info gets outdated fast.
In short: I'd say that in the list, at least a couple hundred calls to
realloc-type functions are constructs of the form
ptr = [realloc] (..., ptr, ...);
And to be safe, all entries on the list would have to be investigated
(if nothing else, to check for leaks).


Do you think this kind of code be checked and fixed for the Wine 1.0
milestone ? That looks doable, if the usual maintainers of /
contributors to each piece of code participate.


Regards,
Lionel.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: realloc_in_wine.txt
Url: http://www.winehq.org/pipermail/wine-devel/attachments/20071222/255b3c0b/attachment-0001.txt 


More information about the wine-devel mailing list