Add missing HeapFree's (found by smatch).
diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c index 97b2eca..ebc3a9e 100644 --- a/dlls/msi/msi.c +++ b/dlls/msi/msi.c
@@ -699,7 +699,8 @@ goto end; MultiByteToWideChar( CP_ACP, 0, szAttribute, -1, szwAttribute, len ); } else { - return ERROR_INVALID_PARAMETER; + hr = ERROR_INVALID_PARAMETER; + goto end; } if( szBuffer ) @@ -1263,7 +1264,10 @@ len = MultiByteToWideChar( CP_ACP, 0, szComponent, -1, NULL, 0 ); szwComponent= HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); if( !szwComponent) + { + HeapFree( GetProcessHeap(), 0, szwProduct); return ERROR_OUTOFMEMORY; + } MultiByteToWideChar( CP_ACP, 0, szComponent, -1, szwComponent, len ); } @@ -1316,7 +1320,10 @@ len = MultiByteToWideChar( CP_ACP, 0, szFeature, -1, NULL, 0 ); szwFeature= HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); if( !szwFeature) + { + HeapFree( GetProcessHeap(), 0, szwProduct); return ERROR_OUTOFMEMORY; + } MultiByteToWideChar( CP_ACP, 0, szFeature, -1, szwFeature, len ); } @@ -1353,13 +1360,19 @@ if(lpVersionBuf && pcchVersionBuf && *pcchVersionBuf) { lpwVersionBuff = HeapAlloc(GetProcessHeap(), 0, *pcchVersionBuf * sizeof(WCHAR)); if( !lpwVersionBuff) - return ERROR_OUTOFMEMORY; + { + ret = ERROR_OUTOFMEMORY; + goto end; + } } if(lpLangBuf && pcchLangBuf && *pcchLangBuf) { lpwLangBuff = HeapAlloc(GetProcessHeap(), 0, *pcchVersionBuf * sizeof(WCHAR)); if( !lpwLangBuff) - return ERROR_OUTOFMEMORY; + { + ret = ERROR_OUTOFMEMORY; + goto end; + } } ret = MsiGetFileVersionW(szwFilePath, lpwVersionBuff, pcchVersionBuf, lpwLangBuff, pcchLangBuf); @@ -1369,6 +1382,7 @@ if(lpwLangBuff) WideCharToMultiByte(CP_ACP, 0, lpwLangBuff, -1, lpLangBuf, *pcchLangBuf, NULL, NULL); +end: if(szwFilePath) HeapFree(GetProcessHeap(), 0, szwFilePath); if(lpwVersionBuff) HeapFree(GetProcessHeap(), 0, lpwVersionBuff); if(lpwLangBuff) HeapFree(GetProcessHeap(), 0, lpwLangBuff);
diff --git a/dlls/msi/msiquery.c b/dlls/msi/msiquery.c index c30cd26..f8a8aaf 100644 --- a/dlls/msi/msiquery.c +++ b/dlls/msi/msiquery.c
@@ -121,6 +121,7 @@ r = MsiDatabaseOpenViewW( hdb, szwQuery, phView); + HeapFree( GetProcessHeap(), 0, szwQuery ); return r; }
diff --git a/dlls/msi/table.c b/dlls/msi/table.c index 790ba31..50250ab 100644 --- a/dlls/msi/table.c +++ b/dlls/msi/table.c
@@ -1203,7 +1203,10 @@ else p = HeapAlloc( GetProcessHeap(), 0, sz ); if( !p ) + { + HeapFree( GetProcessHeap(), 0, row ); return ERROR_NOT_ENOUGH_MEMORY; + } tv->table->data = p; tv->table->data[tv->table->row_count] = row;