[FFmpeg-cvslog] jpegls: factorize return paths

Reinhard Tartler git at videolan.org
Mon Jul 29 03:25:51 CEST 2013


ffmpeg | branch: release/0.10 | Reinhard Tartler <siretart at tauware.de> | Fri May 31 22:36:47 2013 +0200| [ca4a25acf89b715f8f587c947be7145d637a67d1] | committer: Reinhard Tartler

jpegls: factorize return paths

Conflicts:
	libavcodec/jpeglsdec.c

(cherry picked from commit 4a4107b48944397c914aa39ee16a82fe44db8c4c)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ca4a25acf89b715f8f587c947be7145d637a67d1
---

 libavcodec/jpeglsdec.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c
index ca0224c..63bf5cf 100644
--- a/libavcodec/jpeglsdec.c
+++ b/libavcodec/jpeglsdec.c
@@ -260,7 +260,7 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor
     int i, t = 0;
     uint8_t *zero, *last, *cur;
     JLSState *state;
-    int off = 0, stride = 1, width, shift;
+    int off = 0, stride = 1, width, shift, ret = 0;
 
     zero = av_mallocz(s->picture_ptr->linesize[0]);
     last = zero;
@@ -326,9 +326,8 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor
         }
     } else if (ilv == 2) { /* sample interleaving */
         av_log(s->avctx, AV_LOG_ERROR, "Sample interleaved images are not supported.\n");
-        av_free(state);
-        av_free(zero);
-        return AVERROR_PATCHWELCOME;
+        ret = AVERROR_PATCHWELCOME;
+        goto end;
     }
 
     if(shift){ /* we need to do point transform or normalize samples */
@@ -356,10 +355,12 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near, int point_transfor
             }
         }
     }
+
+end:
     av_free(state);
     av_free(zero);
 
-    return 0;
+    return ret;
 }
 
 



More information about the ffmpeg-cvslog mailing list