History

avfilter/vf_showpalette: Don't pretend disp_palette can fail

It can't fail, yet it returns an int and other code checks whether it failed; yet if it did fail, an AVFrame would leak. One could of course add an av_frame_free for this (that compilers could optimize away), yet it is easier to simply stop pretending that disp_palette could fail.

Andreas Rheinhardt committed 6 years ago

Commit 3f2be531 parent 05475ad1 file · +3 −5Browse files

Unified · Split

libavfilter/vf_showpalette.c+3−5
@@ -76,7 +76,7 @@ static int config_output(AVFilterLink *outlink) · 75 unmodified lines
7676 return 0;
7777 }
7878
79−static int disp_palette(AVFrame *out, const AVFrame *in, int size)
79+static void disp_palette(AVFrame *out, const AVFrame *in, int size)
8080 {
8181 int x, y, i, j;
8282 uint32_t *dst = (uint32_t *)out->data[0];
@@ -88,12 +88,10 @@ static int disp_palette(AVFrame *out, const AVFrame *in, int size) · 5 unmodified lines
8888 for (j = 0; j < size; j++)
8989 for (i = 0; i < size; i++)
9090 dst[(y*dst_linesize + x) * size + j*dst_linesize + i] = pal[y*16 + x];
91− return 0;
9291 }
9392
9493 static int filter_frame(AVFilterLink *inlink, AVFrame *in)
9594 {
96− int ret;
9795 AVFrame *out;
9896 AVFilterContext *ctx = inlink->dst;
9997 const ShowPaletteContext *s = ctx->priv;
@@ -105,9 +103,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 5 unmodified lines
105103 return AVERROR(ENOMEM);
106104 }
107105 av_frame_copy_props(out, in);
108− ret = disp_palette(out, in, s->size);
106+ disp_palette(out, in, s->size);
109107 av_frame_free(&in);
110− return ret < 0 ? ret : ff_filter_frame(outlink, out);
108+ return ff_filter_frame(outlink, out);
111109 }
112110
113111 static const AVFilterPad showpalette_inputs[] = {

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