[FFmpeg-cvslog] avcodec/utils: Avoid hardcoding duplicated types in sizeof()

Michael Niedermayer git at videolan.org
Fri Apr 13 02:55:46 EEST 2018


ffmpeg | branch: release/3.3 | Michael Niedermayer <michael at niedermayer.cc> | Sun Jun  4 01:53:58 2017 +0200| [7965ffbeb111af1a8c676ca587e0ab5927c374d4] | committer: Michael Niedermayer

avcodec/utils: Avoid hardcoding duplicated types in sizeof()

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 860d991fcd715233b5b9eb1f6c7bf0aadefb6061)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7965ffbeb111af1a8c676ca587e0ab5927c374d4
---

 libavcodec/utils.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 9363026695..9064cb31d6 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1270,7 +1270,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
     if (ret < 0)
         return ret;
 
-    avctx->internal = av_mallocz(sizeof(AVCodecInternal));
+    avctx->internal = av_mallocz(sizeof(*avctx->internal));
     if (!avctx->internal) {
         ret = AVERROR(ENOMEM);
         goto end;
@@ -2795,7 +2795,7 @@ void avsubtitle_free(AVSubtitle *sub)
 
     av_freep(&sub->rects);
 
-    memset(sub, 0, sizeof(AVSubtitle));
+    memset(sub, 0, sizeof(*sub));
 }
 
 static int do_decode(AVCodecContext *avctx, AVPacket *pkt)



More information about the ffmpeg-cvslog mailing list