History

Merge remote branch 'qatar/master'

* qatar/master: (23 commits) doc: Check standalone compilation before submitting new components. Fix standalone compilation of pipe protocol. Fix standalone compilation of ac3_fixed encoder. Fix standalone compilation of binkaudio_dct / binkaudio_rdft decoders. Fix standalone compilation of IMC decoder. Fix standalone compilation of WTV demuxer. Fix standalone compilation of MXPEG decoder. flashsv: K&R cosmetics matroskaenc: fix memory leak vc1: make overlap filter for I-frames bit-exact. vc1dec: use s->start/end_mb_y instead of passing them as function args. Revert "VC1: merge idct8x8, coeff adjustments and put_pixels." Replace strncpy() with av_strlcpy(). indeo3: Eliminate use of long. get_bits: make cache unsigned to eliminate undefined signed overflow. asfdec: fix assert failure on invalid files avfilter: check malloc return values. Not pulled as reason for reindent is not pulled: mpegvideo: reindent. nutenc: check malloc return values. Not pulled due to much simpler solution in ffmpeg *: don't av_malloc(0). ... Conflicts: doc/developer.texi libavcodec/Makefile libavcodec/get_bits.h libavcodec/mpegvideo.c libavformat/Makefile libavutil/log.c

Michael Niedermayer committed 15 years ago

Commit b000b862 parents 9a5624a af1ca2425 files · +490 −319Browse files

Showing the changes to libavfilter/avfilter.c (1 of 25 files). Show all

Unified · Split

libavfilter/avfilter.c+26−1
@@ -585,28 +585,53 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *in · 584 unmodified lines
585585 return AVERROR(EINVAL);
586586
587587 ret = av_mallocz(sizeof(AVFilterContext));
588+ if (!ret)
589+ return AVERROR(ENOMEM);
588590
589591 ret->av_class = &avfilter_class;
590592 ret->filter = filter;
591593 ret->name = inst_name ? av_strdup(inst_name) : NULL;
592− ret->priv = av_mallocz(filter->priv_size);
594+ if (filter->priv_size) {
595+ ret->priv = av_mallocz(filter->priv_size);
596+ if (!ret->priv)
597+ goto err;
598+ }
593599
594600 ret->input_count = pad_count(filter->inputs);
595601 if (ret->input_count) {
596602 ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->input_count);
603+ if (!ret->input_pads)
604+ goto err;
597605 memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->input_count);
598606 ret->inputs = av_mallocz(sizeof(AVFilterLink*) * ret->input_count);
607+ if (!ret->inputs)
608+ goto err;
599609 }
600610
601611 ret->output_count = pad_count(filter->outputs);
602612 if (ret->output_count) {
603613 ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->output_count);
614+ if (!ret->output_pads)
615+ goto err;
604616 memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->output_count);
605617 ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->output_count);
618+ if (!ret->outputs)
619+ goto err;
606620 }
607621
608622 *filter_ctx = ret;
609623 return 0;
624+
625+err:
626+ av_freep(&ret->inputs);
627+ av_freep(&ret->input_pads);
628+ ret->input_count = 0;
629+ av_freep(&ret->outputs);
630+ av_freep(&ret->output_pads);
631+ ret->output_count = 0;
632+ av_freep(&ret->priv);
633+ av_free(ret);
634+ return AVERROR(ENOMEM);
610635 }
611636
612637 void avfilter_free(AVFilterContext *filter)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t