[lxc-devel] [go-lxc/v2] util: use calloc() correctly

brauner on Github lxc-bot at linuxcontainers.org
Tue Sep 25 01:01:25 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 366 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180925/769ec17a/attachment.bin>
-------------- next part --------------
From 8dbfc92481f4598f12d510586b32553f49cc3e80 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Tue, 25 Sep 2018 03:00:00 +0200
Subject: [PATCH] util: use calloc() correctly

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 util.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util.go b/util.go
index f178195..fba2dab 100644
--- a/util.go
+++ b/util.go
@@ -12,7 +12,7 @@ package lxc
 
 static char** makeCharArray(size_t size) {
     // caller checks return value
-    return calloc(sizeof(char*), size);
+    return calloc(size, sizeof(char*));
 }
 
 static void setArrayString(char **array, char *string, size_t n) {


More information about the lxc-devel mailing list