mirror of https://git.ffmpeg.org/ffmpeg.git
fftools/ffmpeg_filter: do not leak graph_desc on fg_create() failure
fg_create() is passed a malloced string and assumed to always take ownership of it.
This commit is contained in:
parent
181c204145
commit
84c2ca6fa0
|
@ -1058,8 +1058,10 @@ int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch)
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
fgp = av_mallocz(sizeof(*fgp));
|
fgp = av_mallocz(sizeof(*fgp));
|
||||||
if (!fgp)
|
if (!fgp) {
|
||||||
|
av_freep(&graph_desc);
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
}
|
||||||
fg = &fgp->fg;
|
fg = &fgp->fg;
|
||||||
|
|
||||||
if (pfg) {
|
if (pfg) {
|
||||||
|
@ -1068,6 +1070,7 @@ int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch)
|
||||||
} else {
|
} else {
|
||||||
ret = av_dynarray_add_nofree(&filtergraphs, &nb_filtergraphs, fgp);
|
ret = av_dynarray_add_nofree(&filtergraphs, &nb_filtergraphs, fgp);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
av_freep(&graph_desc);
|
||||||
av_freep(&fgp);
|
av_freep(&fgp);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue