mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-14 00:00:44 +00:00
CID:1087631 In the unlikely case the sprintf fails, free the memory instead of leak it
This commit is contained in:
parent
bf8b88cddd
commit
bdbefdcc48
@ -2043,6 +2043,8 @@ static void switch_xml_user_cache(const char *key, const char *user_name, const
|
|||||||
char *expires_val = malloc(1024);
|
char *expires_val = malloc(1024);
|
||||||
if (sprintf(expires_val, "%ld", (long)expires)) {
|
if (sprintf(expires_val, "%ld", (long)expires)) {
|
||||||
switch_core_hash_insert(CACHE_EXPIRES_HASH, mega_key, expires_val);
|
switch_core_hash_insert(CACHE_EXPIRES_HASH, mega_key, expires_val);
|
||||||
|
} else {
|
||||||
|
switch_safe_free(expires_val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch_core_hash_insert(CACHE_HASH, mega_key, switch_xml_dup(user));
|
switch_core_hash_insert(CACHE_HASH, mega_key, switch_xml_dup(user));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user