mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-05-21 00:46:44 +08:00
avformat/hashenc: fix incorrect use of av_mallocz_array()
Fixes CID 1453867, CID 1453866, CID 1453865. Signed-off-by: Moritz Barsnick <barsnick@gmx.net> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:

committed by
Michael Niedermayer

parent
648f5c9382
commit
e9e9f79a19
@ -85,7 +85,7 @@ static int hash_init(struct AVFormatContext *s)
|
|||||||
int res;
|
int res;
|
||||||
struct HashContext *c = s->priv_data;
|
struct HashContext *c = s->priv_data;
|
||||||
c->per_stream = 0;
|
c->per_stream = 0;
|
||||||
c->hashes = av_mallocz_array(1, sizeof(c->hashes));
|
c->hashes = av_mallocz_array(1, sizeof(*c->hashes));
|
||||||
if (!c->hashes)
|
if (!c->hashes)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
res = av_hash_alloc(&c->hashes[0], c->hash_name);
|
res = av_hash_alloc(&c->hashes[0], c->hash_name);
|
||||||
@ -102,7 +102,7 @@ static int streamhash_init(struct AVFormatContext *s)
|
|||||||
int res, i;
|
int res, i;
|
||||||
struct HashContext *c = s->priv_data;
|
struct HashContext *c = s->priv_data;
|
||||||
c->per_stream = 1;
|
c->per_stream = 1;
|
||||||
c->hashes = av_mallocz_array(s->nb_streams, sizeof(c->hashes));
|
c->hashes = av_mallocz_array(s->nb_streams, sizeof(*c->hashes));
|
||||||
if (!c->hashes)
|
if (!c->hashes)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
for (i = 0; i < s->nb_streams; i++) {
|
for (i = 0; i < s->nb_streams; i++) {
|
||||||
@ -270,7 +270,7 @@ static int framehash_init(struct AVFormatContext *s)
|
|||||||
int res;
|
int res;
|
||||||
struct HashContext *c = s->priv_data;
|
struct HashContext *c = s->priv_data;
|
||||||
c->per_stream = 0;
|
c->per_stream = 0;
|
||||||
c->hashes = av_mallocz_array(1, sizeof(c->hashes));
|
c->hashes = av_mallocz_array(1, sizeof(*c->hashes));
|
||||||
if (!c->hashes)
|
if (!c->hashes)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
res = av_hash_alloc(&c->hashes[0], c->hash_name);
|
res = av_hash_alloc(&c->hashes[0], c->hash_name);
|
||||||
|
Reference in New Issue
Block a user