https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9ea2222967054bc086d6cf5f2b75935b13f2d60e

commit 9ea2222967054bc086d6cf5f2b75935b13f2d60e
Author:     Thamatip Chitpong <thamatip.chitp...@reactos.org>
AuthorDate: Sun Dec 3 08:15:08 2023 +0700
Commit:     GitHub <nore...@github.com>
CommitDate: Sun Dec 3 08:15:08 2023 +0700

    [HH] Check LoadLibrary and GetProcAddress return value (#6082)
    
    Handle failure cases.
---
 base/applications/hh/main.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/base/applications/hh/main.c b/base/applications/hh/main.c
index 3d06156167b..beb2882ee4e 100644
--- a/base/applications/hh/main.c
+++ b/base/applications/hh/main.c
@@ -15,11 +15,14 @@ WinMain(HINSTANCE hInst,
     int ret = -1;
 
     hModule = LoadLibraryA("hhctrl.ocx");
-    doWinMain = (DOWINMAIN*) GetProcAddress(hModule, "doWinMain");
+    if (hModule)
+    {
+        doWinMain = (DOWINMAIN*)GetProcAddress(hModule, "doWinMain");
+        if (doWinMain)
+            ret = doWinMain(hInst, cmdline);
 
-    ret = doWinMain(hInst, cmdline);
-
-    FreeLibrary(hModule);
+        FreeLibrary(hModule);
+    }
 
     return ret;
 }

Reply via email to