avstring-test: fix memory leaks
authorMans Rullgard <mans@mansr.com>
Fri, 12 Oct 2012 21:20:09 +0000 (22:20 +0100)
committerMans Rullgard <mans@mansr.com>
Fri, 12 Oct 2012 22:51:12 +0000 (23:51 +0100)
Signed-off-by: Mans Rullgard <mans@mansr.com>
libavutil/avstring.c

index 9b88c0b..6b3a65c 100644 (file)
@@ -197,10 +197,12 @@ int main(void)
         };
 
         for (i=0; i < FF_ARRAY_ELEMS(strings); i++) {
-            const char *p= strings[i];
+            const char *p = strings[i], *q;
             printf("|%s|", p);
-            printf(" -> |%s|", av_get_token(&p, ":"));
+            q = av_get_token(&p, ":");
+            printf(" -> |%s|", q);
             printf(" + |%s|\n", p);
+            av_free(q);
         }
     }