[FFmpeg-devel] [PATCH 6/6] sws: replace av_fast_realloc() with av_realloc_reuse()

Anton Khirnov anton at khirnov.net
Wed Sep 28 13:48:54 EEST 2022


---
 libswscale/swscale_internal.h | 2 +-
 libswscale/utils.c            | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index abeebbb002..1566bb50fe 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -91,7 +91,7 @@ typedef struct Range {
 typedef struct RangeList {
     Range          *ranges;
     unsigned int nb_ranges;
-    int             ranges_allocated;
+    size_t          ranges_allocated;
 } RangeList;
 
 int ff_range_add(RangeList *r, unsigned int start, unsigned int len);
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 45baa22b23..67d1cd9fd5 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -2570,8 +2570,8 @@ int ff_range_add(RangeList *rl, unsigned int start, unsigned int len)
             return AVERROR(EINVAL);
     }
 
-    tmp = av_fast_realloc(rl->ranges, &rl->ranges_allocated,
-                          (rl->nb_ranges + 1) * sizeof(*rl->ranges));
+    tmp = av_realloc_reuse(rl->ranges, &rl->ranges_allocated,
+                           (rl->nb_ranges + 1) * sizeof(*rl->ranges));
     if (!tmp)
         return AVERROR(ENOMEM);
     rl->ranges = tmp;
-- 
2.35.1



More information about the ffmpeg-devel mailing list