diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-01-23 22:21:51 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-01-23 22:22:53 +0100 |
commit | 665f2d432ccdfef91d4b3fa640582160076b18eb (patch) | |
tree | 58c17439aab30a3e9ae6c9900622243a06563c49 | |
parent | 8071288601cc5412f596d1cef4d5eb5f7beaf91f (diff) | |
download | ffmpeg-665f2d432ccdfef91d4b3fa640582160076b18eb.tar.gz |
hls: add missing checks for accessing avoption fields
Fixes null pointer exception and probably other things
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavformat/hls.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libavformat/hls.c b/libavformat/hls.c index 8e46c2b875..1512122410 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -482,17 +482,17 @@ static int hls_read_header(AVFormatContext *s) c->interrupt_callback = &s->interrupt_callback; // if the URL context is good, read important options we must broker later - if (u) { + if (u && u->prot->priv_data_class) { // get the previous user agent & set back to null if string size is zero - av_free(c->user_agent); + av_freep(&c->user_agent); av_opt_get(u->priv_data, "user-agent", 0, (uint8_t**)&(c->user_agent)); - if (!strlen(c->user_agent)) + if (c->user_agent && !strlen(c->user_agent)) av_freep(&c->user_agent); // get the previous cookies & set back to null if string size is zero - av_free(c->cookies); + av_freep(&c->cookies); av_opt_get(u->priv_data, "cookies", 0, (uint8_t**)&(c->cookies)); - if (!strlen(c->cookies)) + if (c->cookies && !strlen(c->cookies)) av_freep(&c->cookies); } |