[FFmpeg-devel] [PATCH] jpeg2000dec: fix memleaks in error cases in jpeg2000_decode_frame()
Michael Niedermayer
michaelni at gmx.at
Mon May 6 22:52:06 CEST 2013
On Mon, May 06, 2013 at 10:32:05PM +0200, Nicolas BERTRAND wrote:
> Le 06/05/13 22:11, Michael Niedermayer a écrit :
> >Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> >---
> > libavcodec/jpeg2000dec.c | 11 +++++++----
> > 1 file changed, 7 insertions(+), 4 deletions(-)
> >
> >diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
> >index ac69d7e..63405c4 100644
> >--- a/libavcodec/jpeg2000dec.c
> >+++ b/libavcodec/jpeg2000dec.c
> >@@ -1288,26 +1288,29 @@ static int jpeg2000_decode_frame(AVCodecContext *avctx, void *data,
> > return -1;
> > }
> > if (ret = jpeg2000_read_main_headers(s))
> >- return ret;
> >+ goto fail;
> > /* get picture buffer */
> > if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) {
> > av_log(avctx, AV_LOG_ERROR, "ff_thread_get_buffer() failed.\n");
> >- return ret;
> >+ goto fail;
> > }
> > picture->pict_type = AV_PICTURE_TYPE_I;
> > picture->key_frame = 1;
> > if (ret = jpeg2000_read_bitstream_packets(s))
> >- return ret;
> >+ goto fail;
> > for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++)
> > if (ret = jpeg2000_decode_tile(s, s->tile + tileno, picture))
> >- return ret;
> >+ goto fail;
> > jpeg2000_dec_cleanup(s);
> > *got_frame = 1;
> > return s->buf - s->buf_start;
> >+fail:
> >+ jpeg2000_dec_cleanup(s);
> >+ return ret;
> > }
> > #define OFFSET(x) offsetof(Jpeg2000DecoderContext, x)
> LVGTM :)
applied
thanks
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130506/0cd2eef4/attachment.asc>
More information about the ffmpeg-devel
mailing list