ffserver: initialize pbuffer in prepare_sdp_description()
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 2 Aug 2014 12:03:30 +0000 (14:03 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 2 Aug 2014 16:32:37 +0000 (18:32 +0200)
also check pbuffer before use

Found-by: CSA
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
ffserver.c

index 00153b4..956d9f5 100644 (file)
@@ -2977,6 +2977,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;
@@ -3013,7 +3015,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)