]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
CID:1087631 In the unlikely case the sprintf fails, free the memory instead of leak it
authorWilliam King <william.king@quentustech.com>
Thu, 15 May 2014 02:56:32 +0000 (19:56 -0700)
committerWilliam King <william.king@quentustech.com>
Thu, 15 May 2014 02:56:32 +0000 (19:56 -0700)
src/switch_xml.c

index dad3d495039910be8d1f89c987d304ac27d81676..8a5b76a98b4ca1702671cf598fb5e5018be4fcd4 100644 (file)
@@ -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));