History

Plug some memory leaks Commited in SoC by Vitor Sessak on 2008-05-24 17:15:18

Originally committed as revision 13357 to svn://svn.ffmpeg.org/ffmpeg/trunk

Vitor Sessak committed 18 years ago

Commit 64b164f1 parent 90ed0761 file · +12 −2Browse files

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

Unified · Split

libavfilter/graphparser.c+12−2
@@ -144,8 +144,10 @@ static AVFilterContext *create_filter(AVFilterGraph *ctx, int index, · 143 unmodified lines
144144 return NULL;
145145 }
146146
147− if(avfilter_graph_add_filter(ctx, filt) < 0)
147+ if(avfilter_graph_add_filter(ctx, filt) < 0) {
148+ avfilter_destroy(filt);
148149 return NULL;
150+ }
149151
150152 if(avfilter_init_filter(filt, args, NULL)) {
151153 av_log(log_ctx, AV_LOG_ERROR,
@@ -164,19 +166,24 @@ static AVFilterContext *parse_filter(const char **buf, AVFilterGraph *graph, · 12 unmodified lines
164166 {
165167 char *opts = NULL;
166168 char *name = consume_string(buf);
169+ AVFilterContext *ret;
167170
168171 if(**buf == '=') {
169172 (*buf)++;
170173 opts = consume_string(buf);
171174 }
172175
173− return create_filter(graph, index, name, opts, log_ctx);
176+ ret = create_filter(graph, index, name, opts, log_ctx);
177+ av_free(name);
178+ av_free(opts);
179+ return ret;
174180 }
175181
176182 static void free_inout(AVFilterInOut *head)
177183 {
178184 while(head) {
179185 AVFilterInOut *next = head->next;
186+ av_free(head->name);
180187 av_free(head);
181188 head = next;
182189 }
@@ -222,6 +229,7 @@ static int link_filter_inouts(AVFilterContext *filter, · 39 unmodified lines
222229 if(p->filter) {
223230 if(link_filter(p->filter, p->pad_idx, filter, pad, log_ctx))
224231 return -1;
232+ av_free(p->name);
225233 av_free(p);
226234 } else {
227235 p->filter = filter;
@@ -318,6 +326,8 @@ static int parse_outputs(const char **buf, AVFilterInOut **currInputs, · 90 unmodified lines
318326 if(link_filter(input->filter, input->pad_idx,
319327 match->filter, match->pad_idx, log_ctx) < 0)
320328 return -1;
329+ av_free(match->name);
330+ av_free(name);
321331 av_free(match);
322332 av_free(input);
323333 } else {

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