]> granicus.if.org Git - libexpat/commitdiff
Fix misuse of realloc in tcase_add_test()
authorRhodri James <rhodri@kynesim.co.uk>
Wed, 24 May 2017 12:23:31 +0000 (13:23 +0100)
committerSebastian Pipping <sebastian@pipping.org>
Wed, 24 May 2017 17:08:54 +0000 (19:08 +0200)
expat/tests/minicheck.c

index 5a1f5ed0e252e94e5f6b81f519ab7e15c9c915b3..9003d3b7fd72321d70e3a5766f7d38f1bbf0a246 100644 (file)
@@ -63,10 +63,7 @@ tcase_add_test(TCase *tc, tcase_test_function test)
         size_t new_size = sizeof(tcase_test_function) * nalloc;
         tcase_test_function *new_tests = realloc(tc->tests, new_size);
         assert(new_tests != NULL);
-        if (new_tests != tc->tests) {
-            free(tc->tests);
-            tc->tests = new_tests;
-        }
+        tc->tests = new_tests;
         tc->allocated = nalloc;
     }
     tc->tests[tc->ntests] = test;