[FFmpeg-devel] avformat/hashenc: fix incorrect use of av_mallocz_array()

Submitted by Moritz Barsnick on Sept. 22, 2019, 12:24 p.m.

Details

Message ID 20190922122411.3183-1-barsnick@gmx.net
State Accepted
Commit e9e9f79a1908899a315eed760e55b2c32ec1e55b
Headers show

Commit Message

Moritz Barsnick Sept. 22, 2019, 12:24 p.m.
Fixes CID 1453867, CID 1453866, CID 1453865.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
---
 libavformat/hashenc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--
2.20.1

Comments

Michael Niedermayer Sept. 23, 2019, 8:52 p.m.
On Sun, Sep 22, 2019 at 02:24:11PM +0200, Moritz Barsnick wrote:
> Fixes CID 1453867, CID 1453866, CID 1453865.
> 
> Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
> ---
>  libavformat/hashenc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

will apply

thx

[...]

Patch hide | download patch | download mbox

diff --git a/libavformat/hashenc.c b/libavformat/hashenc.c
index 8e090731ae..34a8fd1f50 100644
--- a/libavformat/hashenc.c
+++ b/libavformat/hashenc.c
@@ -85,7 +85,7 @@  static int hash_init(struct AVFormatContext *s)
     int res;
     struct HashContext *c = s->priv_data;
     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)
         return AVERROR(ENOMEM);
     res = av_hash_alloc(&c->hashes[0], c->hash_name);
@@ -102,7 +102,7 @@  static int streamhash_init(struct AVFormatContext *s)
     int res, i;
     struct HashContext *c = s->priv_data;
     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)
         return AVERROR(ENOMEM);
     for (i = 0; i < s->nb_streams; i++) {
@@ -270,7 +270,7 @@  static int framehash_init(struct AVFormatContext *s)
     int res;
     struct HashContext *c = s->priv_data;
     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)
         return AVERROR(ENOMEM);
     res = av_hash_alloc(&c->hashes[0], c->hash_name);