libavformat/http: Refactor and fix additional leaks in get_cookies.
authorRichard Shaffer <rshaffer@tunein.com>
Thu, 19 Apr 2018 19:55:00 +0000 (12:55 -0700)
committerwm4 <nfxjfg@googlemail.com>
Thu, 19 Apr 2018 20:01:51 +0000 (22:01 +0200)
commitc705476c4788ab7c5e4c4ee00aab9bbc038cf700
tree495526c541f2c68fe943d22ed7e3a2fdbd4bda86
parentb22db4f465c9adb2cf1489e04f7b65ef6bb55b8b
libavformat/http: Refactor and fix additional leaks in get_cookies.

This refactors get_cookies to simplify some code paths, specifically for
skipping logic in the while loop or exiting it. It also simplifies the logic
for appending additional values to *cookies by replacing strlen/malloc/snprintf
with one call av_asnprintf.

This refactor fixes a bug where the cookie_params AVDictionary would get leaked
if we failed to allocate a new buffer for writing to *cookies.
libavformat/http.c