lavc/avpacket: check for malloc failure