From 1e9b5dbc4e6e87a0672c3170391dea2ba0951202 Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 17 Jan 2019 19:57:36 +0300 Subject: [PATCH] Memory allocation fix --- codecCtx.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/codecCtx.go b/codecCtx.go index dab7f28..0971725 100644 --- a/codecCtx.go +++ b/codecCtx.go @@ -71,9 +71,8 @@ static char * gmf_get_channel_layout_name(int channels, int layout) { av_bprint_init(&pbuf, 0, 1); av_bprint_channel_layout(&pbuf, channels, layout); - char *result = av_malloc(sizeof(char)*1024); + char *result = av_mallocz(pbuf.len); - memset(&result, 0x00, sizeof(result)); memcpy(result, pbuf.str, pbuf.len); av_bprint_clear(&pbuf);