st = av_mallocz(sizeof(AVStream));
memcpy(st, ic->streams[i], sizeof(AVStream));
st->codec = avcodec_alloc_context();
+ if (!st->codec) {
+ print_error(filename, AVERROR(ENOMEM));
+ av_exit(1);
+ }
memcpy(st->codec, ic->streams[i]->codec, sizeof(AVCodecContext));
s->streams[i] = st;
/* get default parameters from command line */
ic = avformat_alloc_context();
+ if (!ic) {
+ print_error(filename, AVERROR(ENOMEM));
+ av_exit(1);
+ }
memset(ap, 0, sizeof(*ap));
ap->prealloced_context = 1;
filename = "pipe:";
oc = avformat_alloc_context();
+ if (!oc) {
+ print_error(filename, AVERROR(ENOMEM));
+ av_exit(1);
+ }
if (!file_oformat) {
file_oformat = guess_format(NULL, filename, NULL);