[FFmpeg-cvslog] jpegls: Check memory allocation
Vittorio Giovara
git at videolan.org
Mon Jun 1 02:08:01 CEST 2015
ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Sun May 31 14:54:11 2015 +0200| [7ca603f96f93d988e01d161d611f69a4ecaa3f02] | committer: Luca Barbato
jpegls: Check memory allocation
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7ca603f96f93d988e01d161d611f69a4ecaa3f02
---
libavcodec/jpeglsdec.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c
index d9b08fb..3b93799 100644
--- a/libavcodec/jpeglsdec.c
+++ b/libavcodec/jpeglsdec.c
@@ -278,10 +278,16 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near,
int off = 0, stride = 1, width, shift, ret = 0;
zero = av_mallocz(s->picture_ptr->linesize[0]);
+ if (!zero)
+ return AVERROR(ENOMEM);
last = zero;
cur = s->picture_ptr->data[0];
state = av_mallocz(sizeof(JLSState));
+ if (!state) {
+ av_free(zero);
+ return AVERROR(ENOMEM);
+ }
/* initialize JPEG-LS state from JPEG parameters */
state->near = near;
state->bpp = (s->bits < 2) ? 2 : s->bits;
More information about the ffmpeg-cvslog
mailing list