]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/jpeglsdec.c
sonic: set avctx->channels in sonic_decode_init
[ffmpeg] / libavcodec / jpeglsdec.c
index 97fc6007214b8ad0d3cef15cfca7492a36c1e9ac..2ea75f7543ef73ea76656cfd1f06922d696a0925 100644 (file)
@@ -349,10 +349,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;