Fix memory corruption found by unit tests.
authorRussell Bryant <russell@russellbryant.com>
Sat, 20 Mar 2010 16:50:38 +0000 (16:50 +0000)
committerRussell Bryant <russell@russellbryant.com>
Sat, 20 Mar 2010 16:50:38 +0000 (16:50 +0000)
ast_str_reset() was being called on a potentially uninitialized pointer.
Valgrind is my hero, once again.

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

funcs/func_strings.c

index fa0174c..184300d 100644 (file)
@@ -525,7 +525,7 @@ static int listfilter(struct ast_channel *chan, const char *cmd, char *parse, ch
 
        flen = strlen(args.fieldvalue);
 
 
        flen = strlen(args.fieldvalue);
 
-       ast_str_reset(result);
+       ast_str_reset(*result_ptr);
        /* Enough space for any result */
        if (len > -1) {
                ast_str_make_space(result_ptr, len ? len : ast_str_strlen(orig_list) + 1);
        /* Enough space for any result */
        if (len > -1) {
                ast_str_make_space(result_ptr, len ? len : ast_str_strlen(orig_list) + 1);