summaryrefslogtreecommitdiff
path: root/libavfilter/graphparser.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-26 14:07:04 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-26 14:24:57 +0200
commit507f2940ccdcedf2fdc064c5fb6022b60bace8ca (patch)
treea367ef88e7671ef3155d52bf0f8137fc1c2b0339 /libavfilter/graphparser.c
parent9f36ec6aa936515a703f6d7ff32826aa28684f1e (diff)
parent1b891d17c531e8a63c2974aab4bf997ce70746f3 (diff)
downloadffmpeg-507f2940ccdcedf2fdc064c5fb6022b60bace8ca.tar.gz
Merge commit '1b891d17c531e8a63c2974aab4bf997ce70746f3'
* commit '1b891d17c531e8a63c2974aab4bf997ce70746f3': avconv: fix bitrate report when writing to /dev/null avfilter: fix graphparser memleaks on error paths rawdec: remove ff_raw_read_header pcmdec: remove dependency from rawdec g722: refactor out of rawdec.c rawvideo: use a specific read_header Conflicts: ffmpeg.c libavformat/Makefile libavformat/rawdec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/graphparser.c')
-rw-r--r--libavfilter/graphparser.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c
index aed7624ccc..0ce823a10d 100644
--- a/libavfilter/graphparser.c
+++ b/libavfilter/graphparser.c
@@ -239,10 +239,11 @@ static int link_filter_inouts(AVFilterContext *filt_ctx,
return AVERROR(ENOMEM);
if (p->filter_ctx) {
- if ((ret = link_filter(p->filter_ctx, p->pad_idx, filt_ctx, pad, log_ctx)) < 0)
- return ret;
+ ret = link_filter(p->filter_ctx, p->pad_idx, filt_ctx, pad, log_ctx);
av_free(p->name);
av_free(p);
+ if (ret < 0)
+ return ret;
} else {
p->filter_ctx = filt_ctx;
p->pad_idx = pad;
@@ -290,8 +291,10 @@ static int parse_inputs(const char **buf, AVFilterInOut **curr_inputs,
av_free(name);
} else {
/* Not in the list, so add it as an input */
- if (!(match = av_mallocz(sizeof(AVFilterInOut))))
+ if (!(match = av_mallocz(sizeof(AVFilterInOut)))) {
+ av_free(name);
return AVERROR(ENOMEM);
+ }
match->name = name;
match->pad_idx = pad;
}
@@ -319,24 +322,27 @@ static int parse_outputs(const char **buf, AVFilterInOut **curr_inputs,
AVFilterInOut *match;
AVFilterInOut *input = *curr_inputs;
+
+ if (!name)
+ return AVERROR(EINVAL);
+
if (!input) {
av_log(log_ctx, AV_LOG_ERROR,
- "No output pad can be associated to link label '%s'.\n",
- name);
+ "No output pad can be associated to link label '%s'.\n", name);
+ av_free(name);
return AVERROR(EINVAL);
}
*curr_inputs = (*curr_inputs)->next;
- if (!name)
- return AVERROR(EINVAL);
-
/* First check if the label is not in the open_inputs list */
match = extract_inout(name, open_inputs);
if (match) {
if ((ret = link_filter(input->filter_ctx, input->pad_idx,
- match->filter_ctx, match->pad_idx, log_ctx)) < 0)
+ match->filter_ctx, match->pad_idx, log_ctx)) < 0) {
+ av_free(name);
return ret;
+ }
av_free(match->name);
av_free(name);
av_free(match);