Merged revisions 206807 via svnmerge from
authorTilghman Lesher <tilghman@meg.abyt.es>
Thu, 16 Jul 2009 16:51:05 +0000 (16:51 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Thu, 16 Jul 2009 16:51:05 +0000 (16:51 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r206807 | tilghman | 2009-07-16 11:27:35 -0500 (Thu, 16 Jul 2009) | 6 lines

  Fix a memory leak.
  (closes issue #15517)
   Reported by: adomjan
   Patches:
         func_realtime.c-ast_variable_destroy.diff uploaded by adomjan (license 487)
........

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

funcs/func_realtime.c

index b451f72..9add212 100644 (file)
@@ -190,6 +190,8 @@ static int function_realtime_read(struct ast_channel *chan, const char *cmd, cha
                ast_str_append(&out, 0, "%s%s%s%s", var->name, args.delim2, var->value, args.delim1);
        ast_copy_string(buf, ast_str_buffer(out), len);
 
+       ast_variables_destroy(head);
+
        if (chan)
                ast_autoservice_stop(chan);
 
@@ -403,6 +405,7 @@ static int function_realtime_readdestroy(struct ast_channel *chan, const char *c
        ast_copy_string(buf, ast_str_buffer(out), len);
 
        ast_destroy_realtime(args.family, args.fieldmatch, args.value, SENTINEL);
+       ast_variables_destroy(head);
 
        if (chan)
                ast_autoservice_stop(chan);