1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avfilter/signature_lookup: Do not dereference NULL pointers after malloc failure

Fixes: CID 1403229 Dereference after null check

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2024-02-05 12:40:30 +01:00
parent 6c50482951
commit 98ae1ad7cf
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -299,6 +299,11 @@ static MatchingInfo* get_matching_parameters(AVFilterContext *ctx, SignatureCont
if (!c->next) if (!c->next)
av_log(ctx, AV_LOG_FATAL, "Could not allocate memory"); av_log(ctx, AV_LOG_FATAL, "Could not allocate memory");
c = c->next; c = c->next;
}
if (!c) {
sll_free(&cands);
goto error;
} }
c->framerateratio = (i+1.0) / 30; c->framerateratio = (i+1.0) / 30;
c->score = hspace[i][j].score; c->score = hspace[i][j].score;
@ -315,6 +320,7 @@ static MatchingInfo* get_matching_parameters(AVFilterContext *ctx, SignatureCont
} }
} }
} }
error:
for (i = 0; i < MAX_FRAMERATE; i++) { for (i = 0; i < MAX_FRAMERATE; i++) {
av_freep(&hspace[i]); av_freep(&hspace[i]);
} }