[iortcw] 72/95: All: Fix dllHandle possibly being uninitialized in Sys_LoadDll

Simon McVittie smcv at debian.org
Fri Sep 8 10:42:21 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to tag 1.51
in repository iortcw.

commit e431995497c15f70261ad5f265f838073dcd2006
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date:   Fri May 26 16:31:56 2017 -0400

    All: Fix dllHandle possibly being uninitialized in Sys_LoadDll
---
 MP/code/sys/sys_main.c | 7 +++++--
 SP/code/sys/sys_main.c | 9 ++++++---
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/MP/code/sys/sys_main.c b/MP/code/sys/sys_main.c
index 583e89a..054aaa0 100644
--- a/MP/code/sys/sys_main.c
+++ b/MP/code/sys/sys_main.c
@@ -498,7 +498,7 @@ from executable path, then fs_basepath.
 
 void *Sys_LoadDll(const char *name, qboolean useSystemLib)
 {
-	void *dllhandle;
+	void *dllhandle = NULL;
 
 	if(!Sys_DllExtension(name))
 	{
@@ -507,9 +507,12 @@ void *Sys_LoadDll(const char *name, qboolean useSystemLib)
 	}
 	
 	if(useSystemLib)
+	{
 		Com_Printf("Trying to load \"%s\"...\n", name);
+		dllhandle = Sys_LoadLibrary(name);
+	}
 	
-	if(!useSystemLib || !(dllhandle = Sys_LoadLibrary(name)))
+	if(!dllhandle)
 	{
 		const char *topDir;
 		char libPath[MAX_OSPATH];
diff --git a/SP/code/sys/sys_main.c b/SP/code/sys/sys_main.c
index 3b2f35f..93bf1ad 100644
--- a/SP/code/sys/sys_main.c
+++ b/SP/code/sys/sys_main.c
@@ -498,7 +498,7 @@ from executable path, then fs_basepath.
 
 void *Sys_LoadDll(const char *name, qboolean useSystemLib)
 {
-	void *dllhandle;
+	void *dllhandle = NULL;
 
 	if(!Sys_DllExtension(name))
 	{
@@ -507,9 +507,12 @@ void *Sys_LoadDll(const char *name, qboolean useSystemLib)
 	}
 	
 	if(useSystemLib)
+	{
 		Com_Printf("Trying to load \"%s\"...\n", name);
-	
-	if(!useSystemLib || !(dllhandle = Sys_LoadLibrary(name)))
+		dllhandle = Sys_LoadLibrary(name);
+	}
+
+	if(!dllhandle)
 	{
 		const char *topDir;
 		char libPath[MAX_OSPATH];

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git



More information about the Pkg-games-commits mailing list