From: William King Date: Thu, 15 May 2014 02:56:32 +0000 (-0700) Subject: CID:1087631 In the unlikely case the sprintf fails, free the memory instead of leak it X-Git-Tag: v1.4.4~73 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bdbefdcc4813f76b479db6220722a405db1e73d5;p=thirdparty%2Ffreeswitch.git CID:1087631 In the unlikely case the sprintf fails, free the memory instead of leak it --- diff --git a/src/switch_xml.c b/src/switch_xml.c index dad3d49503..8a5b76a98b 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -2043,6 +2043,8 @@ static void switch_xml_user_cache(const char *key, const char *user_name, const char *expires_val = malloc(1024); if (sprintf(expires_val, "%ld", (long)expires)) { 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));