History

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

Fixes: CID 1403229 Dereference after null check

Michael Niedermayer committed 2 years ago

Commit 98ae1ad1 parent 6c504821 file · +6 −0Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/signature_lookup.c+6−0
@@ -299,6 +299,11 @@ static MatchingInfo* get_matching_parameters(AVFilterContext *ctx, SignatureCont · 298 unmodified lines
299299 if (!c->next)
300300 av_log(ctx, AV_LOG_FATAL, "Could not allocate memory");
301301 c = c->next;
302+
303+ }
304+ if (!c) {
305+ sll_free(&cands);
306+ goto error;
302307 }
303308 c->framerateratio = (i+1.0) / 30;
304309 c->score = hspace[i][j].score;
@@ -315,6 +320,7 @@ static MatchingInfo* get_matching_parameters(AVFilterContext *ctx, SignatureCont · 10 unmodified lines
315320 }
316321 }
317322 }
323+ error:
318324 for (i = 0; i < MAX_FRAMERATE; i++) {
319325 av_freep(&hspace[i]);
320326 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t