aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/wpa_ctrl.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2014-12-07 15:16:58 (GMT)
committerJouni Malinen <j@w1.fi>2014-12-08 09:42:07 (GMT)
commit89b48f7b95a6b5ccead65e41dce1e7597955d977 (patch)
treedd5f54f3bfac0a875e309e162241375c10d2e1e9 /src/common/wpa_ctrl.c
parentfaebdeaa9ea5aefc7e45c4d52710c5d67cdbc89f (diff)
downloadhostap-89b48f7b95a6b5ccead65e41dce1e7597955d977.zip
hostap-89b48f7b95a6b5ccead65e41dce1e7597955d977.tar.gz
hostap-89b48f7b95a6b5ccead65e41dce1e7597955d977.tar.bz2
Use os_zalloc() instead of os_malloc() and os_memset()
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>
Diffstat (limited to 'src/common/wpa_ctrl.c')
-rw-r--r--src/common/wpa_ctrl.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/common/wpa_ctrl.c b/src/common/wpa_ctrl.c
index 5820a13..57bed04 100644
--- a/src/common/wpa_ctrl.c
+++ b/src/common/wpa_ctrl.c
@@ -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);