[PATCH] oledb32: avoid leaking propsets on error paths (Coverity)

Marcus Meissner meissner at suse.de
Sat Jan 5 06:14:08 CST 2013


Hi,

CID 966609, if we return failure, propset is not handled
in the callers ... so do not allocate it for unknown
types.

Ciao, Marcus
---
 dlls/oledb32/datainit.c |    6 +++---
 1 Datei geändert, 3 Zeilen hinzugefügt(+), 3 Zeilen entfernt(-)

diff --git a/dlls/oledb32/datainit.c b/dlls/oledb32/datainit.c
index c710367..a870bbc 100644
--- a/dlls/oledb32/datainit.c
+++ b/dlls/oledb32/datainit.c
@@ -293,11 +293,10 @@ static HRESULT set_dbpropset(BSTR name, BSTR value, DBPROPSET **propset)
 {
     static const WCHAR datasourceW[] = {'D','a','t','a',' ','S','o','u','r','c','e',0};
 
-    *propset = CoTaskMemAlloc(sizeof(DBPROPSET));
-    (*propset)->rgProperties = CoTaskMemAlloc(sizeof(DBPROP));
-
     if (!strcmpW(datasourceW, name))
     {
+        *propset = CoTaskMemAlloc(sizeof(DBPROPSET));
+        (*propset)->rgProperties = CoTaskMemAlloc(sizeof(DBPROP));
         (*propset)->cProperties = 1;
         (*propset)->guidPropertySet = DBPROPSET_DBINIT;
         (*propset)->rgProperties[0].dwPropertyID = DBPROP_INIT_DATASOURCE;
@@ -310,6 +309,7 @@ static HRESULT set_dbpropset(BSTR name, BSTR value, DBPROPSET **propset)
     }
     else
     {
+        *propset = NULL;
         FIXME("unsupported property %s\n", debugstr_w(name));
         return E_FAIL;
     }
-- 
1.7.10.4




More information about the wine-patches mailing list