[FFmpeg-devel] [PATCH v2] avformat/hls: release mem resource to fix memleak

Derek Buitenhuis derek.buitenhuis at gmail.com
Sun Dec 31 08:19:49 EET 2017

On 12/31/2017 5:50 AM, Aman Gupta wrote:
> +        int r = av_opt_get(v->input, "http_version", AV_OPT_SEARCH_CHILDREN, &http_version_opt);
> +        if (r >= 0) {
> +            c->http_multiple = strncmp((const char *)http_version_opt, "1.1", 3) == 0;
> +            av_freep(&http_version_opt);
> +        }

I mean, we should probably actually fail on ENOMEM, but I guess av_opt_get is
poorly designed in the sense that it can return fatal and nonfatal sorts of
errors, so I guess this gets no complaints from me.

Looking closer into the implementation of av_opt_get just kind of made me sad,
though. It has a bunch of unchecked allocations, such that it can return 0 but
have the string be NULL. I'll send a patch tomorrow to address that properly.
(Yes, I strongly believe handling allocation failures is still relevant in 2017...)

- Derek

More information about the ffmpeg-devel mailing list