msi: fix memory leaks on error paths (found by Smatch). [2/2]

James Hawkins truiken at gmail.com
Sat Dec 22 11:03:03 CST 2007


On Dec 22, 2007 4:29 AM, Lionel_Debroux <lionel_debroux at yahoo.fr> wrote:
> "msi_load_summary_properties" and "MsiSourceListAddSourceExW" in
> dlls/msi/package.c and dlls/msi/source.c get flagged by Michael
> Stefaniuc's unfree-wine.pl script.
>
> 2007-12-21  Lionel Debroux <lionel_debroux at yahoo.fr>
>         * dlls/msi/package.c, dlls/msi/source.c:
>         msi: fix memory leaks on error paths (found by Smatch).
>

     if (rc != ERROR_SUCCESS)
     {
+        msi_free( package_code );
         WARN("Unable to query rev number: %d\n", rc);
         goto done;
     }

Save a line and move the msi_free a couple lines down to the done: block.

+    {
+        msi_free(source); /* This is correct because msi strdupW
calls msi_alloc. */
         return rc;
+    }

Are you serious?  Please take that comment out.  Either way the fix
isn't really right.  All you need is a 'goto done' because you're
still leaking the reg handles.

-- 
James Hawkins



More information about the wine-devel mailing list