[FFmpeg-cvslog] avfilter/signature_lookup: Check for allocation error

Andreas Rheinhardt git at videolan.org
Sun Feb 18 17:49:40 EET 2024


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Wed Feb 14 00:45:28 2024 +0100| [eeb99dcb51f2c985abb53a8920fdd165a7d4863f] | committer: Andreas Rheinhardt

avfilter/signature_lookup: Check for allocation error

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=eeb99dcb51f2c985abb53a8920fdd165a7d4863f
---

 libavfilter/signature_lookup.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavfilter/signature_lookup.c b/libavfilter/signature_lookup.c
index ad012ecced..90b1d0eadf 100644
--- a/libavfilter/signature_lookup.c
+++ b/libavfilter/signature_lookup.c
@@ -205,11 +205,15 @@ static MatchingInfo* get_matching_parameters(AVFilterContext *ctx, SignatureCont
     } hspace_elem;
 
     /* houghspace */
-    hspace_elem** hspace = av_malloc_array(MAX_FRAMERATE, sizeof(hspace_elem *));
+    hspace_elem **hspace = av_mallocz(MAX_FRAMERATE * sizeof(*hspace));
 
+    if (!hspace)
+        return NULL;
     /* initialize houghspace */
     for (i = 0; i < MAX_FRAMERATE; i++) {
         hspace[i] = av_malloc_array(2 * HOUGH_MAX_OFFSET + 1, sizeof(hspace_elem));
+        if (!hspace[i])
+            goto error;
         for (j = 0; j < 2 * HOUGH_MAX_OFFSET + 1; j++) {
             hspace[i][j].score = 0;
             hspace[i][j].dist = 99999;



More information about the ffmpeg-cvslog mailing list