2011-08-16 09:50:40

by Pavel Raiskup

[permalink] [raw]
Subject: [PATCH 6/8] Removed unnecessary memset

zeroing memory with memset at "buf" position is useless because
g_try_malloc0 zeroes is also. Actually parameter sizeof(buf) is
wrong also (only 8 bytes cause it is a pointer).
---
plugins/mgmtops.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
index 3cdb97e..79a898f 100644
--- a/plugins/mgmtops.c
+++ b/plugins/mgmtops.c
@@ -1877,8 +1877,6 @@ static int mgmt_load_keys(int index, GSList *keys,
gboolean debug_keys)
if (buf == NULL)
return -ENOMEM;

- memset(buf, 0, sizeof(buf));
-
hdr = (void *) buf;
hdr->opcode = htobs(MGMT_OP_LOAD_KEYS);
hdr->len = htobs(cp_size);
--
1.7.4.4


2011-08-30 13:13:59

by Pavel Raiskup

[permalink] [raw]
Subject: [PATCH 6/8] Removed unnecessary memset

zeroing memory with memset at "buf" position is useless because
g_try_malloc0 zeroes it also. Actually parameter sizeof(buf) is
wrong too (only 8 bytes cause it is a pointer).
---
plugins/mgmtops.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
index 3cdb97e..79a898f 100644
--- a/plugins/mgmtops.c
+++ b/plugins/mgmtops.c
@@ -1877,8 +1877,6 @@ static int mgmt_load_keys(int index, GSList *keys, gboolean debug_keys)
if (buf == NULL)
return -ENOMEM;

- memset(buf, 0, sizeof(buf));
-
hdr = (void *) buf;
hdr->opcode = htobs(MGMT_OP_LOAD_KEYS);
hdr->len = htobs(cp_size);
--
1.7.4.4