]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 197538 via svnmerge from
authorJoshua Colp <jcolp@digium.com>
Thu, 28 May 2009 14:54:25 +0000 (14:54 +0000)
committerJoshua Colp <jcolp@digium.com>
Thu, 28 May 2009 14:54:25 +0000 (14:54 +0000)
https://origsvn.digium.com/svn/asterisk/trunk

........
  r197538 | file | 2009-05-28 11:51:43 -0300 (Thu, 28 May 2009) | 5 lines

  Fix a bug in stringfields where it did not actually free the pools of memory.

  (closes issue #15074)
  Reported by: pj
........

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.1@197540 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/utils.c

index 76223498e8451d1c34f33adef3ecfd676c0bfd60..c0418dafccb9fbf493b8000f4bbb04ba17fd645e 100644 (file)
@@ -1530,7 +1530,11 @@ int __ast_string_field_init(struct ast_string_field_mgr *mgr, struct ast_string_
                return add_string_pool(mgr, pool_head, needed, file, lineno, func);
        }
        if (needed < 0) {               /* reset all pools */
-               /* nothing to do */
+               if (*pool_head == NULL) {
+                       ast_log(LOG_WARNING, "trying to reset empty pool\n");
+                       return -1;
+               }
+               cur = *pool_head;
        } else {                        /* preserve the last pool */
                if (*pool_head == NULL) {
                        ast_log(LOG_WARNING, "trying to reset empty pool\n");