diff options
Diffstat (limited to 'src/sh_registry.c')
-rw-r--r-- | src/sh_registry.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/sh_registry.c b/src/sh_registry.c index 16502a6..f940cd2 100644 --- a/src/sh_registry.c +++ b/src/sh_registry.c @@ -349,7 +349,7 @@ static void report_missing_entry(const char * path) char timestr[32]; struct store2db save; - memset(&save, '\0', sizeof(struct store2db)); + memset(&save, 0, sizeof(struct store2db)); sh_hash_db2pop (path, &save); (void) sh_unix_gmttime (save.val1, timestr, sizeof(timestr)); @@ -681,7 +681,7 @@ int QueryKey(HKEY hKey, char * path, size_t pathlen, int isSingle) { struct store2db save; - memset(&save, '\0', sizeof(struct store2db)); + memset(&save, 0, sizeof(struct store2db)); if (tPath) { @@ -773,7 +773,7 @@ int QueryKey(HKEY hKey, char * path, size_t pathlen, int isSingle) { struct store2db save; - memset(&save, '\0', sizeof(struct store2db)); + memset(&save, 0, sizeof(struct store2db)); save.val0 = totalSize; save.val1 = fTime; @@ -840,6 +840,9 @@ int CheckThisSubkey (HKEY key, char * subkey, char * path, int isSingle, char * newpath; size_t len; int retval = -1; + + if (!subkey) + return 0; len = strlen(path) + 1 + strlen(subkey) + 1; newpath = SH_ALLOC(len); @@ -933,7 +936,7 @@ int CheckThisSubkey (HKEY key, char * subkey, char * path, int isSingle, int check_key (char * key, int isSingle) { HKEY topKey; - char * subkey; + char * subkey = NULL; char path[20] = ""; int pos = 0; @@ -973,7 +976,7 @@ int check_key (char * key, int isSingle) } else { - + /* We bail out here if the topKey is undefined */ char * tmp = sh_util_safe_name_keepspace(key); size_t tlen = sl_strlen(tmp); @@ -1002,6 +1005,8 @@ int check_key (char * key, int isSingle) } *************************/ + /* Returns 0 if !subkey */ + /* cppcheck-suppress uninitvar */ return CheckThisSubkey (topKey, subkey, path, isSingle, 0); } |