avformat/libsrt: fix for the memory leak if passphrase has been configured by option
authorLimin Wang <lance.lmwang@gmail.com>
Fri, 20 Sep 2019 11:17:28 +0000 (19:17 +0800)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 6 Dec 2019 10:25:29 +0000 (11:25 +0100)
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/libsrt.c

index 1c34ec5..fd27e36 100644 (file)
@@ -494,6 +494,7 @@ static int libsrt_open(URLContext *h, const char *uri, int flags)
             s->pbkeylen = strtol(buf, NULL, 10);
         }
         if (av_find_info_tag(buf, sizeof(buf), "passphrase", p)) {
             s->pbkeylen = strtol(buf, NULL, 10);
         }
         if (av_find_info_tag(buf, sizeof(buf), "passphrase", p)) {
+            av_freep(&s->passphrase);
             s->passphrase = av_strndup(buf, strlen(buf));
         }
         if (av_find_info_tag(buf, sizeof(buf), "mss", p)) {
             s->passphrase = av_strndup(buf, strlen(buf));
         }
         if (av_find_info_tag(buf, sizeof(buf), "mss", p)) {