]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Use os_zalloc() instead of os_malloc() and os_memset()
authorJouni Malinen <j@w1.fi>
Sun, 7 Dec 2014 15:16:58 +0000 (17:16 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 8 Dec 2014 09:42:07 +0000 (11:42 +0200)
Automatically updated with spatch and the following semantic patch:

@@
expression X;
expression E1;
statement S;
@@

- X = os_malloc(E1);
+ X = os_zalloc(E1);
(
  if (X == NULL) {
...
  }
- os_memset(X, 0, E1);
|
  if (X == NULL)
S
- os_memset(X, 0, E1);
)

Signed-off-by: Jouni Malinen <j@w1.fi>
src/common/wpa_ctrl.c

index 5820a1364f3f721cdbccec49fc0fe7c3ad63cc53..57bed04146fae762c6cc6875d121fd64b8f92371 100644 (file)
@@ -94,10 +94,9 @@ struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path)
        if (ctrl_path == NULL)
                return NULL;
 
-       ctrl = os_malloc(sizeof(*ctrl));
+       ctrl = os_zalloc(sizeof(*ctrl));
        if (ctrl == NULL)
                return NULL;
-       os_memset(ctrl, 0, sizeof(*ctrl));
 
        ctrl->s = socket(PF_UNIX, SOCK_DGRAM, 0);
        if (ctrl->s < 0) {
@@ -283,10 +282,9 @@ struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path)
        struct hostent *h;
 #endif /* CONFIG_CTRL_IFACE_UDP_REMOTE */
 
-       ctrl = os_malloc(sizeof(*ctrl));
+       ctrl = os_zalloc(sizeof(*ctrl));
        if (ctrl == NULL)
                return NULL;
-       os_memset(ctrl, 0, sizeof(*ctrl));
 
 #ifdef CONFIG_CTRL_IFACE_UDP_IPV6
        ctrl->s = socket(PF_INET6, SOCK_DGRAM, 0);