History

avfilter: Remove redundant ff_formats/channel_layouts_unref()

ff_add_format() and ff_add_channel_layout() already unref the list upon error.

Andreas Rheinhardt committed 6 years ago

Commit e013a711 parent 257cd5f3 files · +4 −7Browse files

Unified · Split

3 files
  1. libavfilter/af_aformat.c +4 −5
  2. libavfilter/vf_shuffleplanes.c +0 −1
  3. libavfilter/vf_weave.c +0 −1
libavfilter/af_aformat.c+4−5
@@ -60,7 +60,7 @@ static const AVOption aformat_options[] = { · 59 unmodified lines
60 60
61AVFILTER_DEFINE_CLASS(aformat);61AVFILTER_DEFINE_CLASS(aformat);
62 62
63#define PARSE_FORMATS(str, type, list, add_to_list, unref_fn, get_fmt, none, desc) \63#define PARSE_FORMATS(str, type, list, add_to_list, get_fmt, none, desc) \
64do { \64do { \
65 char *next, *cur = str, sep; \65 char *next, *cur = str, sep; \
66 int ret; \66 int ret; \
@@ -83,7 +83,6 @@ do { \ · 16 unmodified lines
83 return AVERROR(EINVAL); \83 return AVERROR(EINVAL); \
84 } \84 } \
85 if ((ret = add_to_list(&list, fmt)) < 0) { \85 if ((ret = add_to_list(&list, fmt)) < 0) { \
86 unref_fn(&list); \
87 return ret; \86 return ret; \
88 } \87 } \
89 \88 \
@@ -102,11 +101,11 @@ static av_cold int init(AVFilterContext *ctx) · 12 unmodified lines
102 AFormatContext *s = ctx->priv;101 AFormatContext *s = ctx->priv;
103 102
104 PARSE_FORMATS(s->formats_str, enum AVSampleFormat, s->formats,103 PARSE_FORMATS(s->formats_str, enum AVSampleFormat, s->formats,
105 ff_add_format, ff_formats_unref, av_get_sample_fmt, AV_SAMPLE_FMT_NONE, "sample format");104 ff_add_format, av_get_sample_fmt, AV_SAMPLE_FMT_NONE, "sample format");
106 PARSE_FORMATS(s->sample_rates_str, int, s->sample_rates, ff_add_format, ff_formats_unref,105 PARSE_FORMATS(s->sample_rates_str, int, s->sample_rates, ff_add_format,
107 get_sample_rate, 0, "sample rate");106 get_sample_rate, 0, "sample rate");
108 PARSE_FORMATS(s->channel_layouts_str, uint64_t, s->channel_layouts,107 PARSE_FORMATS(s->channel_layouts_str, uint64_t, s->channel_layouts,
109 ff_add_channel_layout, ff_channel_layouts_unref, av_get_channel_layout, 0,108 ff_add_channel_layout, av_get_channel_layout, 0,
110 "channel layout");109 "channel layout");
111 110
112 return 0;111 return 0;
libavfilter/vf_shuffleplanes.c+0−1
@@ -64,7 +64,6 @@ static int query_formats(AVFilterContext *ctx) · 63 unmodified lines
64 if (i != 4)64 if (i != 4)
65 continue;65 continue;
66 if ((ret = ff_add_format(&formats, fmt)) < 0) {66 if ((ret = ff_add_format(&formats, fmt)) < 0) {
67 ff_formats_unref(&formats);
68 return ret;67 return ret;
69 }68 }
70 }69 }
libavfilter/vf_weave.c+0−1
@@ -60,7 +60,6 @@ static int query_formats(AVFilterContext *ctx) · 59 unmodified lines
60 if (!(desc->flags & AV_PIX_FMT_FLAG_PAL) &&60 if (!(desc->flags & AV_PIX_FMT_FLAG_PAL) &&
61 !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {61 !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
62 if ((ret = ff_add_format(&formats, fmt)) < 0) {62 if ((ret = ff_add_format(&formats, fmt)) < 0) {
63 ff_formats_unref(&formats);
64 return ret;63 return ret;
65 }64 }
66 }65 }

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