[FFmpeg-devel,1/3] avcodec/utils: Avoid hardcoding duplicated types in sizeof()

Submitted by Michael Niedermayer on June 4, 2017, 12:25 a.m.

Details

Message ID 20170604002546.5707-1-michael@niedermayer.cc
State New
Headers show

Commit Message

Michael Niedermayer June 4, 2017, 12:25 a.m.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/utils.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Michael Niedermayer Jan. 12, 2018, 9:53 p.m.
On Sun, Jun 04, 2017 at 02:25:44AM +0200, Michael Niedermayer wrote:
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/utils.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

applied

[...]

Patch hide | download patch | download mbox

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 1336e921c9..cde5849a41 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -655,7 +655,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;
@@ -1157,7 +1157,7 @@  void avsubtitle_free(AVSubtitle *sub)
 
     av_freep(&sub->rects);
 
-    memset(sub, 0, sizeof(AVSubtitle));
+    memset(sub, 0, sizeof(*sub));
 }
 
 av_cold int avcodec_close(AVCodecContext *avctx)