Skip to content

Commit

Permalink
avcodec/bsf: fix resource leak in av_bsf_list_parse_str
Browse files Browse the repository at this point in the history
cid: 1396268
when av_strdup(str) error, the lst need release

Reviewed-by: James Almer <[email protected]>
Signed-off-by: Steven Liu <[email protected]>
  • Loading branch information
T-bagwell committed Jan 10, 2017
1 parent f48b6b8 commit d9c2cfd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libavcodec/bsf.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,10 @@ int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf_lst)
if (!lst)
return AVERROR(ENOMEM);

if (!(dup = buf = av_strdup(str)))
return AVERROR(ENOMEM);
if (!(dup = buf = av_strdup(str))) {
ret = AVERROR(ENOMEM);
goto end;
}

while (1) {
bsf_str = av_strtok(buf, ",", &saveptr);
Expand Down

0 comments on commit d9c2cfd

Please sign in to comment.