diff mbox series

[FFmpeg-devel,2/3] avformat/paf: Do not zero allocated tables which are immedeately filled

Message ID 20210119233223.21888-2-michael@niedermayer.cc
State Accepted
Headers show
Series [FFmpeg-devel,1/3] avformat/asfdec_o: Check for EOF in asf_read_marker()
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer Jan. 19, 2021, 11:32 p.m. UTC
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/paf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Paul B Mahol Jan. 20, 2021, 4:01 p.m. UTC | #1
could make use of av_malloc_array while there.

On Wed, Jan 20, 2021 at 12:38 AM Michael Niedermayer <michael@niedermayer.cc>
wrote:

> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/paf.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libavformat/paf.c b/libavformat/paf.c
> index 9587111643..bcd6213a45 100644
> --- a/libavformat/paf.c
> +++ b/libavformat/paf.c
> @@ -149,11 +149,11 @@ static int read_header(AVFormatContext *s)
>          p->frame_blks     > INT_MAX / sizeof(uint32_t))
>          return AVERROR_INVALIDDATA;
>
> -    p->blocks_count_table  = av_mallocz(p->nb_frames *
> +    p->blocks_count_table  = av_malloc(p->nb_frames *
>                                          sizeof(*p->blocks_count_table));
> -    p->frames_offset_table = av_mallocz(p->nb_frames *
> +    p->frames_offset_table = av_malloc(p->nb_frames *
>                                          sizeof(*p->frames_offset_table));
> -    p->blocks_offset_table = av_mallocz(p->frame_blks *
> +    p->blocks_offset_table = av_malloc(p->frame_blks *
>                                          sizeof(*p->blocks_offset_table));
>
>      p->video_size  = p->max_video_blks * p->buffer_size;
> --
> 2.17.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Michael Niedermayer Jan. 21, 2021, 6:11 p.m. UTC | #2
On Wed, Jan 20, 2021 at 05:01:20PM +0100, Paul B Mahol wrote:
> could make use of av_malloc_array while there.

ok, will apply with av_malloc_array()

thx

[...]
diff mbox series

Patch

diff --git a/libavformat/paf.c b/libavformat/paf.c
index 9587111643..bcd6213a45 100644
--- a/libavformat/paf.c
+++ b/libavformat/paf.c
@@ -149,11 +149,11 @@  static int read_header(AVFormatContext *s)
         p->frame_blks     > INT_MAX / sizeof(uint32_t))
         return AVERROR_INVALIDDATA;
 
-    p->blocks_count_table  = av_mallocz(p->nb_frames *
+    p->blocks_count_table  = av_malloc(p->nb_frames *
                                         sizeof(*p->blocks_count_table));
-    p->frames_offset_table = av_mallocz(p->nb_frames *
+    p->frames_offset_table = av_malloc(p->nb_frames *
                                         sizeof(*p->frames_offset_table));
-    p->blocks_offset_table = av_mallocz(p->frame_blks *
+    p->blocks_offset_table = av_malloc(p->frame_blks *
                                         sizeof(*p->blocks_offset_table));
 
     p->video_size  = p->max_video_blks * p->buffer_size;