[PATCH] use calloc in place of malloc+memset-0
Jim Meyering
jim at meyering.net
Mon Sep 27 14:00:07 UTC 2010
FYI, noticed this while poking around in the vicinity:
(also switched from sizeof(TYPE) to preferred sizeof(*VAR))
>From bba237a9d3d15caf36736a28ec0669329bace040 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Mon, 27 Sep 2010 15:52:06 +0200
Subject: [PATCH] use calloc in place of malloc+memset-0
---
rest.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/rest.c b/rest.c
index 36c318f..498c8da 100644
--- a/rest.c
+++ b/rest.c
@@ -1600,11 +1600,10 @@ access_handler (void *cctx, struct MHD_Connection *conn, const char *url,
data,data_size,rctx);
}
- ms = malloc(sizeof(my_state));
+ ms = calloc(sizeof(*ms), 1);
if (!ms) {
return MHD_NO;
}
- memset(ms,0,sizeof(*ms));
utype = parse_url(url,ms);
--
1.7.3.264.g8bb1
More information about the iwhd-devel
mailing list