SMATCH: Returning with freed result

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

this was found by unfree-wine.pl a slight modification of smatch's
unfree.pl. The first occurence was easy to fix (see attachment) but i
don't know what should be done in this case:
dlls/ole32/filemoniker.c 1084 1086 FileMonikerImpl_CommonPrefixWith(75)
Returning with freed result var_decl(commonPath)
This is due to this code:
	HeapFree(GetProcessHeap(),0,commonPath);
	return CreateFileMoniker(commonPath,ppmkPrefix);
I would save the return of CreateFileMoniker to a temp variable and
after that free commonPath but i don't know if it's the desired fix.

License: LGPL, X11
Changelog:
	Michael Stefaniuc <mstefani@redhat.com>
	- fix for return of a previous freed object

bye
	michael
-- 
Michael Stefaniuc               Tel.: +49-711-96437-199
System Administration           Fax.: +49-711-96437-111
Red Hat GmbH                    Email: mstefani@redhat.com
Hauptstaetterstr. 58            http://www.redhat.de/
D-70178 Stuttgart
Index: dlls/ddraw/main.c
===================================================================
RCS file: /home/wine/wine/dlls/ddraw/main.c,v
retrieving revision 1.31
diff -u -r1.31 main.c
--- dlls/ddraw/main.c	15 Mar 2003 00:12:43 -0000	1.31
+++ dlls/ddraw/main.c	2 Apr 2003 22:17:16 -0000
@@ -388,8 +388,10 @@
 
     TRACE("(%p)->() decrementing from %ld.\n", This, This->ref);
 
-    if (--This->ref == 0)
+    if (--This->ref == 0) {
 	HeapFree(GetProcessHeap(), 0, This);
+	return 0;
+    }
 
     return This->ref;
 }

Attachment: pgp00116.pgp
Description: PGP signature


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux