[PATCH] netprofm: fix memleak in error exit (Coverity)

Marcus Meissner marcus at jet.franken.de
Mon Sep 7 02:07:56 CDT 2015


1322992 Resource leak
---
 dlls/netprofm/list.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/dlls/netprofm/list.c b/dlls/netprofm/list.c
index 197ef68..33b2fa6 100644
--- a/dlls/netprofm/list.c
+++ b/dlls/netprofm/list.c
@@ -1681,7 +1681,11 @@ static void init_networks( struct list_manager *mgr )
     if (ret != ERROR_BUFFER_OVERFLOW) return;
 
     if (!(buf = heap_alloc( size ))) return;
-    if (GetAdaptersAddresses( WS_AF_UNSPEC, flags, NULL, buf, &size )) return;
+    if (GetAdaptersAddresses( WS_AF_UNSPEC, flags, NULL, buf, &size ))
+    {
+        heap_free( buf );
+        return;
+    }
 
     memset( &id, 0, sizeof(id) );
     for (aa = buf; aa; aa = aa->Next)
-- 
2.5.0




More information about the wine-patches mailing list