tests/api-seek: fix memory leak on realloc() failure
authorJames Almer <jamrial@gmail.com>
Sat, 11 Mar 2017 23:29:40 +0000 (20:29 -0300)
committerJames Almer <jamrial@gmail.com>
Sun, 12 Mar 2017 17:29:11 +0000 (14:29 -0300)
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
tests/api/api-seek-test.c

index e4276eb9c8330e05be8cf45654860a6b12bc5ebe..4fd1e6ea045611660d624fee12fa595431dfbe31 100644 (file)
@@ -40,8 +40,8 @@ static int add_crc_to_array(uint32_t crc, int64_t pts)
         if (size_of_array == 0)
             size_of_array = 10;
         size_of_array *= 2;
-        crc_array = av_realloc(crc_array, size_of_array * sizeof(uint32_t));
-        pts_array = av_realloc(pts_array, size_of_array * sizeof(int64_t));
+        crc_array = av_realloc_f(crc_array, size_of_array, sizeof(uint32_t));
+        pts_array = av_realloc_f(pts_array, size_of_array, sizeof(int64_t));
         if ((crc_array == NULL) || (pts_array == NULL)) {
             av_log(NULL, AV_LOG_ERROR, "Can't allocate array to store crcs\n");
             return AVERROR(ENOMEM);