diff options
author | Martin Storsjö <martin@martin.st> | 2014-07-04 22:13:39 +0300 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2014-07-27 10:14:33 -0400 |
commit | f6b3dce952d66f87883a50d90d6e98416ee397df (patch) | |
tree | 4f757c48b9e4be912431b8bb3866e4d346b73001 | |
parent | b8e57113ecba5494d4bf47c29634392ea5fdb17b (diff) | |
download | ffmpeg-f6b3dce952d66f87883a50d90d6e98416ee397df.tar.gz |
librtmp: Don't free the temp url at the end of rtmp_open
librtmp can keep pointers to this string internally, and may
use them at shutdown as well.
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 865461099e062de5a3a109c2a5be98004c11d8bd)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
Conflicts:
libavformat/librtmp.c
-rw-r--r-- | libavformat/librtmp.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libavformat/librtmp.c b/libavformat/librtmp.c index 7133bd655b..5682c9cb03 100644 --- a/libavformat/librtmp.c +++ b/libavformat/librtmp.c @@ -38,6 +38,7 @@ typedef struct LibRTMPContext { RTMP rtmp; char *app; char *playpath; + char *temp_filename; } LibRTMPContext; static void rtmp_log(int level, const char *fmt, va_list args) @@ -62,6 +63,7 @@ static int rtmp_close(URLContext *s) RTMP *r = &ctx->rtmp; RTMP_Close(r); + av_freep(&ctx->temp_filename); return 0; } @@ -101,7 +103,7 @@ static int rtmp_open(URLContext *s, const char *uri, int flags) if (ctx->app) len += strlen(ctx->app) + sizeof(" app="); if (ctx->playpath) len += strlen(ctx->playpath) + sizeof(" playpath="); - if (!(filename = av_malloc(len))) + if (!(ctx->temp_filename = filename = av_malloc(len))) return AVERROR(ENOMEM); av_strlcpy(filename, s->filename, len); @@ -130,10 +132,9 @@ static int rtmp_open(URLContext *s, const char *uri, int flags) } s->is_streamed = 1; - rc = 0; + return 0; fail: - if (filename != s->filename) - av_freep(&filename); + av_freep(&ctx->temp_filename); return rc; } |