diff --git a/libavformat/wtvenc.c b/libavformat/wtvenc.c
index e8a2b72a723943c774c238531a4aa3e2a5ad219f..8aebdddf03300a8831176e6db5e844388a85df34 100644
--- a/libavformat/wtvenc.c
+++ b/libavformat/wtvenc.c
@@ -112,7 +112,7 @@ typedef struct {
 static void add_serial_pair(WtvSyncEntry ** list, int * count, int64_t serial, int64_t value)
 {
     int new_count = *count + 1;
-    WtvSyncEntry *new_list = av_realloc(*list, new_count * sizeof(WtvSyncEntry));
+    WtvSyncEntry *new_list = av_realloc_array(*list, new_count, sizeof(WtvSyncEntry));
     if (!new_list)
         return;
     new_list[*count] = (WtvSyncEntry){serial, value};