fg_create() is passed a malloced string and assumed to always take ownership of it.
Unified · Split
| @@ -1058,8 +1058,10 @@ int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch) · 1057 unmodified lines | ||
| 1058 | 1058 | int ret = 0; |
| 1059 | 1059 | |
| 1060 | 1060 | fgp = av_mallocz(sizeof(*fgp)); |
| 1061 | − if (!fgp) | |
| 1061 | + if (!fgp) { | |
| 1062 | + av_freep(&graph_desc); | |
| 1062 | 1063 | return AVERROR(ENOMEM); |
| 1064 | + } | |
| 1063 | 1065 | fg = &fgp->fg; |
| 1064 | 1066 | |
| 1065 | 1067 | if (pfg) { |
| @@ -1068,6 +1070,7 @@ int fg_create(FilterGraph **pfg, char *graph_desc, Scheduler *sch) · 2 unmodified lines | ||
| 1068 | 1070 | } else { |
| 1069 | 1071 | ret = av_dynarray_add_nofree(&filtergraphs, &nb_filtergraphs, fgp); |
| 1070 | 1072 | if (ret < 0) { |
| 1073 | + av_freep(&graph_desc); | |
| 1071 | 1074 | av_freep(&fgp); |
| 1072 | 1075 | return ret; |
| 1073 | 1076 | } |