]> git.sesse.net Git - ffmpeg/commitdiff
tools/uncoded_frame: fix double free
authorLukasz Marek <lukasz.m.luki@gmail.com>
Wed, 12 Feb 2014 20:16:16 +0000 (21:16 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 13 Feb 2014 00:29:01 +0000 (01:29 +0100)
in case av_interleaved_write_uncoded_frame fails it seems
frame is freed for the second time in fail section.

Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
Reviewed-by: Nicolas George <george@nsup.org>
This commit also removes 1 trailing whitespace as otherwise the push hook rejects it

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tools/uncoded_frame.c

index da04d06ea1dcd2191fca7e99206df9c11fcd99cd..eafbbfde17ca638e90e3f56c05713de3297d5117 100644 (file)
@@ -182,7 +182,7 @@ int main(int argc, char **argv)
             st->stream->codec->channel_layout = st->link->channel_layout;
             st->stream->codec->channels = avfilter_link_get_channels(st->link);
             st->stream->codec->sample_rate = st->link->sample_rate;
-            st->stream->codec->sample_fmt = st->link->format; 
+            st->stream->codec->sample_fmt = st->link->format;
             break;
         default:
             av_assert0(!"reached");
@@ -245,12 +245,12 @@ int main(int argc, char **argv)
                 ret = av_interleaved_write_uncoded_frame(st->mux,
                                                          st->stream->index,
                                                          frame);
+                frame = NULL;
                 if (ret < 0) {
                     av_log(st->stream->codec, AV_LOG_ERROR,
                            "Error writing frame: %s\n", av_err2str(ret));
                     goto fail;
                 }
-                frame = NULL;
             }
         }
     }