Ver código fonte

Resolve a resource leak in test_util_split_lines

Fixes coverity CID # 488
Nick Mathewson 12 anos atrás
pai
commit
e83862a0ff
1 arquivos alterados com 4 adições e 2 exclusões
  1. 4 2
      src/test/test_util.c

+ 4 - 2
src/test/test_util.c

@@ -1660,7 +1660,7 @@ test_util_split_lines(void *ptr)
 
   int i, j;
   char *orig_line;
-  smartlist_t *sl;
+  smartlist_t *sl=NULL;
 
   (void)ptr;
 
@@ -1689,10 +1689,12 @@ test_util_split_lines(void *ptr)
     tt_assert(tests[i].split_line[j] == NULL);
     tor_free(orig_line);
     smartlist_free(sl);
+    sl = NULL;
   }
 
  done:
-  ;
+  tor_free(orig_line);
+  smartlist_free(sl);
 }
 
 static void