>> + if (user) >> + av_freep(&user); >> + if (headers) >> + av_freep(&headers); > > pointless ifs I'm pretty sure I need it, since there are possible cases where these are not allocated and I can't free them.