Author: mjansen
Date: Mon Feb 27 18:54:57 2017
New Revision: 73999
URL:
http://svn.reactos.org/svn/reactos?rev=73999&view=rev
Log:
[APPCOMPAT] Fix a memory leak in a failure case (CID 1401161), a 0-length memset that is
detected 3 times (CID 1401069, 1401064, 1401062)
Modified:
trunk/reactos/dll/appcompat/apphelp/hsdb.c
trunk/reactos/dll/appcompat/shims/shimlib/implement_shim.inl
Modified: trunk/reactos/dll/appcompat/apphelp/hsdb.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/apphelp/hsdb…
==============================================================================
--- trunk/reactos/dll/appcompat/apphelp/hsdb.c [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/apphelp/hsdb.c [iso-8859-1] Mon Feb 27 18:54:57 2017
@@ -65,7 +65,9 @@
case SDB_DATABASE_MAIN_SHIM: name = shim; break;
case SDB_DATABASE_MAIN_MSI: name = msi; break;
case SDB_DATABASE_MAIN_DRIVERS: name = drivers; break;
- default: return NULL;
+ default:
+ SdbReleaseDatabase(sdb);
+ return NULL;
}
SdbGetAppPatchDir(NULL, buffer, 128);
memcpy(buffer + lstrlenW(buffer), name, SdbpStrlen(name));
Modified: trunk/reactos/dll/appcompat/shims/shimlib/implement_shim.inl
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/appcompat/shims/shimli…
==============================================================================
--- trunk/reactos/dll/appcompat/shims/shimlib/implement_shim.inl [iso-8859-1] (original)
+++ trunk/reactos/dll/appcompat/shims/shimlib/implement_shim.inl [iso-8859-1] Mon Feb 27
18:54:57 2017
@@ -39,7 +39,8 @@
SHIM_OBJ_NAME(g_szCommandLine) = "";
}
SHIM_OBJ_NAME(g_pAPIHooks) = ShimLib_ShimMalloc(sizeof(HOOKAPI) * SHIM_NUM_HOOKS);
- ZeroMemory(SHIM_OBJ_NAME(g_pAPIHooks), sizeof(HOOKAPI) * SHIM_NUM_HOOKS);
+ if (SHIM_NUM_HOOKS)
+ ZeroMemory(SHIM_OBJ_NAME(g_pAPIHooks), sizeof(HOOKAPI) * SHIM_NUM_HOOKS);
*pdwHookCount = SHIM_NUM_HOOKS;
#ifdef SHIM_NOTIFY_FN