shell32.iconcache.c: Fix two memory leaks

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

 



Changelog
  dlls/shell32/iconcache.c
    Fix two memory leaks. Found by Dietrich Teickner from Odin.

Rolf Kalbermatter

Index: dlls/shell32/iconcache.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/iconcache.c,v
retrieving revision 1.69
diff -u -r1.69 iconcache.c
--- dlls/shell32/iconcache.c	17 Sep 2003 20:15:21 -0000	1.69
+++ dlls/shell32/iconcache.c	28 Nov 2003 08:06:59 -0000
@@ -91,7 +91,7 @@
  * SIC_IconAppend			[internal]
  *
  * NOTES
- *  appends a icon pair to the end of the cache
+ *  appends an icon pair to the end of the cache
  */
 static INT SIC_IconAppend (LPCSTR sSourceFile, INT dwSourceIndex, HICON hSmallIcon, HICON hBigIcon)
 {	LPSIC_ENTRY lpsice;
@@ -101,9 +101,9 @@
 
 	lpsice = (LPSIC_ENTRY) SHAlloc (sizeof (SIC_ENTRY));
 
-        path = PathFindFileNameA(sSourceFile);
-        lpsice->sSourceFile = HeapAlloc( GetProcessHeap(), 0, strlen(path)+1 );
-        strcpy( lpsice->sSourceFile, path );
+	path = PathFindFileNameA(sSourceFile);
+	lpsice->sSourceFile = HeapAlloc( GetProcessHeap(), 0, strlen(path)+1 );
+	strcpy( lpsice->sSourceFile, path );
 
 	lpsice->dwSourceIndex = dwSourceIndex;
 
@@ -112,6 +112,7 @@
 	index = DPA_InsertPtr(sic_hdpa, 0x7fff, lpsice);
 	if ( INVALID_INDEX == index )
 	{
+	  HeapFree(GetProcessHeap(), 0, lpsice->sSourceFile);
 	  SHFree(lpsice);
 	  ret = INVALID_INDEX;
 	}
@@ -269,8 +270,9 @@
  */
 static INT CALLBACK sic_free( LPVOID ptr, LPVOID lparam )
 {
-    SHFree(ptr);
-    return TRUE;
+	HeapFree(GetProcessHeap(), 0, (LPSIC_ENTRY)ptr->sSourceFile);
+	SHFree(ptr);
+	return TRUE;
 }
 
 void SIC_Destroy(void)




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

  Powered by Linux