[vlc-devel] [PATCH 1/3] avio: fix potential memory leak

Steve Lhomme robux4 at videolabs.io
Fri Aug 5 09:20:03 CEST 2016


---
 modules/access/avio.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/modules/access/avio.c b/modules/access/avio.c
index 3a3b478..1efa5fa 100644
--- a/modules/access/avio.c
+++ b/modules/access/avio.c
@@ -158,10 +158,9 @@ int OpenAvio(vlc_object_t *object)
     };
     AVDictionary *options = NULL;
     char *psz_opts = var_InheritString(access, "avio-options");
-    if (psz_opts && *psz_opts) {
+    if (psz_opts && *psz_opts)
         options = vlc_av_get_options(psz_opts);
-        free(psz_opts);
-    }
+    free(psz_opts);
     ret = avio_open2(&sys->context, url, AVIO_FLAG_READ, &cb, &options);
     AVDictionaryEntry *t = NULL;
     while ((t = av_dict_get(options, "", t, AV_DICT_IGNORE_SUFFIX)))
@@ -238,10 +237,9 @@ int OutOpenAvio(vlc_object_t *object)
 #else
     AVDictionary *options = NULL;
     char *psz_opts = var_InheritString(access, "sout-avio-options");
-    if (psz_opts && *psz_opts) {
+    if (psz_opts && *psz_opts)
         options = vlc_av_get_options(psz_opts);
-        free(psz_opts);
-    }
+    free(psz_opts);
     ret = avio_open2(&sys->context, access->psz_path, AVIO_FLAG_WRITE,
                      NULL, &options);
     AVDictionaryEntry *t = NULL;
-- 
2.8.2



More information about the vlc-devel mailing list