Commit 150ae769 authored by Michael Niedermayer's avatar Michael Niedermayer

ffserver: initialize pbuffer in prepare_sdp_description()

also check pbuffer before use

Found-by: CSA
Reviewed-by: 's avatarStefano Sabatini <stefasab@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1d8d21b9)
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 7d691327
...@@ -2972,6 +2972,8 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer, ...@@ -2972,6 +2972,8 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL); AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL);
int i; int i;
*pbuffer = NULL;
avc = avformat_alloc_context(); avc = avformat_alloc_context();
if (avc == NULL || !rtp_format) { if (avc == NULL || !rtp_format) {
return -1; return -1;
...@@ -3008,7 +3010,7 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer, ...@@ -3008,7 +3010,7 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
av_free(avc); av_free(avc);
av_free(avs); av_free(avs);
return strlen(*pbuffer); return *pbuffer ? strlen(*pbuffer) : AVERROR(ENOMEM);
} }
static void rtsp_cmd_options(HTTPContext *c, const char *url) static void rtsp_cmd_options(HTTPContext *c, const char *url)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment