bsf: check memory allocations

This commit is contained in:
Vittorio Giovara
2014-12-18 20:26:56 +01:00
parent 014b6b416f
commit 8a9641a652
7 changed files with 24 additions and 3 deletions

View File

@@ -47,9 +47,17 @@ AVBitStreamFilterContext *av_bitstream_filter_init(const char *name)
if (!strcmp(name, bsf->name)) {
AVBitStreamFilterContext *bsfc =
av_mallocz(sizeof(AVBitStreamFilterContext));
if (!bsfc)
return NULL;
bsfc->filter = bsf;
bsfc->priv_data =
bsf->priv_data_size ? av_mallocz(bsf->priv_data_size) : NULL;
bsfc->priv_data = NULL;
if (bsf->priv_data_size) {
bsfc->priv_data = av_mallocz(bsf->priv_data_size);
if (!bsfc->priv_data) {
av_freep(&bsfc);
return NULL;
}
}
return bsfc;
}
bsf = bsf->next;