On Dec 9, 2007 5:00 AM, Lionel_Debroux <[EMAIL PROTECTED]> wrote: > "msi_dialog_list_box" in dlls/msi/dialog.c gets flagged by Michael > Stefaniuc's unfree-wine.pl script. > > * As far as I can see, "info", allocated line 2203, is not used before > the return that leaks it (line 2214), neither in a direct nor an > indirect (macro) way. But maybe the "fail-fast" behaviour is intended > (because if allocation of "info" fails, there are chances the allocation > of "control" would fail, too) ? > * While looking at the source of the functions called by > "msi_dialog_list_box" to make sure they didn't use "info", I spotted a > call to msi_alloc, whose result is not checked. Therefore, the > subsequent lines may write to NULL+some_offset. > > The patch contains only the fix for the latter problem, because I'm not > 100% sure that the memory leak can be solved by moving the allocation of > info after the call to "msi_dialog_add_control", without ill side > effects (e.g. msi_dialog_add_control calls msi_dialog_create_window, > which calls CreateWindowExW). > > > 2007-12-09 Lionel Debroux <[EMAIL PROTECTED]> > * dlls/msi/dialog.c: > msi: fix missing alloc check. >
+ if (control) + { + strcpyW( control->name, name ); Just check if control is NULL, and if so, return NULL. There's no need to add a whole extra level of indentation. -- James Hawkins