[FFmpeg-cvslog] jpegls: factorize return paths

Reinhard Tartler git at videolan.org
Mon Jun 3 00:22:22 CEST 2013


ffmpeg | branch: release/1.1 | Reinhard Tartler <siretart at tauware.de> | Fri May 31 22:36:47 2013 +0200| [582aec49892dd42eb8bab5d4837f656a4b821188] | 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=582aec49892dd42eb8bab5d4837f656a4b821188
---

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

diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c
index b0badbb..15bf962 100644
--- a/libavcodec/jpeglsdec.c
+++ b/libavcodec/jpeglsdec.c
@@ -259,7 +259,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;
@@ -329,9 +329,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 */
@@ -359,10 +358,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