[FFmpeg-cvslog] ffserver: initialize pbuffer in prepare_sdp_description()

Michael Niedermayer git at videolan.org
Tue Aug 5 04:58:09 CEST 2014


ffmpeg | branch: release/2.2 | Michael Niedermayer <michaelni at gmx.at> | Sat Aug  2 14:03:30 2014 +0200| [119131fcbfdca9eda0b18d2de8401ad07e616324] | committer: Michael Niedermayer

ffserver: initialize pbuffer in prepare_sdp_description()

also check pbuffer before use

Found-by: CSA
Reviewed-by: Stefano Sabatini <stefasab at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 1d8d21b90ab91aa471f369e0f9d1ea20fb40733b)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 ffserver.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ffserver.c b/ffserver.c
index c2d2180..d0038e6 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -2989,6 +2989,8 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
     AVDictionaryEntry *entry = av_dict_get(stream->metadata, "title", NULL, 0);
     int i;
 
+    *pbuffer = NULL;
+
     avc =  avformat_alloc_context();
     if (avc == NULL || !rtp_format) {
         return -1;
@@ -3025,7 +3027,7 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
     av_free(avc);
     av_free(avs);
 
-    return strlen(*pbuffer);
+    return *pbuffer ? strlen(*pbuffer) : AVERROR(ENOMEM);
 }
 
 static void rtsp_cmd_options(HTTPContext *c, const char *url)



More information about the ffmpeg-cvslog mailing list