[vlc-devel] [PATCH 1/3] avio: fix potential memory leak
Steve Lhomme
robux4 at gmail.com
Fri Aug 5 11:22:49 CEST 2016
On Fri, Aug 5, 2016 at 10:18 AM, Rémi Denis-Courmont <remi at remlab.net> wrote:
> Le 2016-08-05 09:20, Steve Lhomme a écrit :
>>
>> ---
>> 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);
>
>
> I don't see a (fix for a) leak there because (*psz_opts) is a tautology.
This is how it's done everywhere else. I'll do a patch with all the
changes then.
> Ditto below.
>
>
>> 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;
>
>
> --
> Rémi Denis-Courmont
> http://www.remlab.net/
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list