Skip to content

Commit 0f6bdc7

Browse files
committed
Fixed potential resource leak of library handle (found by Coverity, CID 989315)
1 parent 8a7f64e commit 0f6bdc7

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

MemoryModule.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ BuildImportTable(PMEMORYMODULE module)
257257

258258
module->modules = (HMODULE *)realloc(module->modules, (module->numModules+1)*(sizeof(HMODULE)));
259259
if (module->modules == NULL) {
260+
FreeLibrary(handle);
260261
result = 0;
261262
break;
262263
}
@@ -284,6 +285,7 @@ BuildImportTable(PMEMORYMODULE module)
284285
}
285286

286287
if (!result) {
288+
FreeLibrary(handle);
287289
break;
288290
}
289291
}

0 commit comments

Comments
 (0)