diff options
| author | Ian Elliott <ian@LunarG.com> | 2015-04-03 13:13:01 -0600 |
|---|---|---|
| committer | Ian Elliott <ian@LunarG.com> | 2015-04-03 13:13:01 -0600 |
| commit | 31aaa22fd655accfec4ea4d8c755741732cc3e3a (patch) | |
| tree | 3c8a614386cf68b34eb3ae695b031a247ef41468 /loader/loader.c | |
| parent | e60cea139865f6c97c8b1744f9db62ae5e845124 (diff) | |
| download | usermoji-31aaa22fd655accfec4ea4d8c755741732cc3e3a.tar.xz | |
Fix NULL-pointer dereference if can't find registry entry.
Diffstat (limited to 'loader/loader.c')
| -rw-r--r-- | loader/loader.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/loader/loader.c b/loader/loader.c index 47cfb364..1de7c846 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -179,7 +179,7 @@ static char *loader_get_registry_and_env(const char *env_var, registry_str = loader_get_registry_string(HKEY_LOCAL_MACHINE, "Software\\XGL", registry_value); - registry_len = strlen(registry_str); + registry_len = (registry_str) ? strlen(registry_str) : 0; rtn_len = env_len + registry_len + 1; if (rtn_len <= 2) { @@ -205,7 +205,9 @@ static char *loader_get_registry_and_env(const char *env_var, _snprintf(rtn_str, rtn_len, "%s", registry_str); } - free(registry_str); + if (registry_str) { + free(registry_str); + } return(rtn_str); } |
