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
6060
6161 AVFILTER_DEFINE_CLASS(aformat);
6262
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) \
6464 do { \
6565 char *next, *cur = str, sep; \
6666 int ret; \
@@ -83,7 +83,6 @@ do { \ · 16 unmodified lines
8383 return AVERROR(EINVAL); \
8484 } \
8585 if ((ret = add_to_list(&list, fmt)) < 0) { \
86− unref_fn(&list); \
8786 return ret; \
8887 } \
8988 \
@@ -102,11 +101,11 @@ static av_cold int init(AVFilterContext *ctx) · 12 unmodified lines
102101 AFormatContext *s = ctx->priv;
103102
104103 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");
106− PARSE_FORMATS(s->sample_rates_str, int, s->sample_rates, ff_add_format, ff_formats_unref,
104+ ff_add_format, av_get_sample_fmt, AV_SAMPLE_FMT_NONE, "sample format");
105+ PARSE_FORMATS(s->sample_rates_str, int, s->sample_rates, ff_add_format,
107106 get_sample_rate, 0, "sample rate");
108107 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,
110109 "channel layout");
111110
112111 return 0;
libavfilter/vf_shuffleplanes.c+0−1
@@ -64,7 +64,6 @@ static int query_formats(AVFilterContext *ctx) · 63 unmodified lines
6464 if (i != 4)
6565 continue;
6666 if ((ret = ff_add_format(&formats, fmt)) < 0) {
67− ff_formats_unref(&formats);
6867 return ret;
6968 }
7069 }
libavfilter/vf_weave.c+0−1
@@ -60,7 +60,6 @@ static int query_formats(AVFilterContext *ctx) · 59 unmodified lines
6060 if (!(desc->flags & AV_PIX_FMT_FLAG_PAL) &&
6161 !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
6262 if ((ret = ff_add_format(&formats, fmt)) < 0) {
63− ff_formats_unref(&formats);
6463 return ret;
6564 }
6665 }

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