avcodec/utils: Avoid hardcoding duplicated types in sizeof()
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 3 Jun 2017 23:53:58 +0000 (01:53 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 13 Jan 2018 01:06:35 +0000 (02:06 +0100)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 860d991fcd715233b5b9eb1f6c7bf0aadefb6061)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/utils.c

index 6d6bbb7..77c0bf8 100644 (file)
@@ -1274,7 +1274,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;
@@ -2766,7 +2766,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)