=?UTF-8?Q?Andr=C3=A9=20Hentschel=20?=: setupapi: Avoid memory leaks ( coverity).

Alexandre Julliard julliard at winehq.org
Mon Oct 29 13:52:50 CDT 2012


Module: wine
Branch: master
Commit: 4d796458d0ed517d45adc57a1aedaf1c3bdde232
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4d796458d0ed517d45adc57a1aedaf1c3bdde232

Author: André Hentschel <nerv at dawncrow.de>
Date:   Sun Oct 28 16:16:58 2012 +0100

setupapi: Avoid memory leaks (coverity).

---

 dlls/setupapi/install.c |    1 +
 dlls/setupapi/queue.c   |    6 +++++-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/dlls/setupapi/install.c b/dlls/setupapi/install.c
index 1c8236a..e216e8c 100644
--- a/dlls/setupapi/install.c
+++ b/dlls/setupapi/install.c
@@ -1640,6 +1640,7 @@ BOOL WINAPI SetupGetInfFileListW(PCWSTR dir, DWORD style, PWSTR buffer,
                                   ( 2 + dir_len + name_len) * sizeof( WCHAR ));
             if( !fullname )
             {
+                FindClose( hdl );
                 HeapFree( GetProcessHeap(), 0, filter );
                 SetLastError( ERROR_NOT_ENOUGH_MEMORY );
                 return FALSE;
diff --git a/dlls/setupapi/queue.c b/dlls/setupapi/queue.c
index cd733a0..1855e99 100644
--- a/dlls/setupapi/queue.c
+++ b/dlls/setupapi/queue.c
@@ -1156,7 +1156,11 @@ BOOL WINAPI SetupInstallFileExW( HINF hinf, PINFCONTEXT inf_context, PCWSTR sour
             SetLastError( ERROR_NOT_ENOUGH_MEMORY );
             return FALSE;
         }
-        if (!SetupGetStringFieldW( inf_context, 1, inf_source, len, NULL )) return FALSE;
+        if (!SetupGetStringFieldW( inf_context, 1, inf_source, len, NULL ))
+        {
+            HeapFree( GetProcessHeap(), 0, inf_source );
+            return FALSE;
+        }
         source = inf_source;
     }
     else if (!source)




More information about the wine-cvs mailing list