From 9bb97adae60f9fabc9ccfcbd5211491bc1128b9c Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Tue, 9 May 2017 08:40:33 +0200 Subject: [PATCH] src/liboping.c: Use sizeof(*ptr) instead of sizeof(type_t). Also remove an unnecessary cast from void* to pingobj_t*. --- src/liboping.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/liboping.c b/src/liboping.c index de82d5f..5a39633 100644 --- a/src/liboping.c +++ b/src/liboping.c @@ -1123,9 +1123,9 @@ pingobj_t *ping_construct (void) { pingobj_t *obj; - if ((obj = (pingobj_t *) malloc (sizeof (pingobj_t))) == NULL) + if ((obj = malloc (sizeof (*obj))) == NULL) return (NULL); - memset (obj, 0, sizeof (pingobj_t)); + memset (obj, 0, sizeof (*obj)); obj->timeout = PING_DEF_TIMEOUT; obj->ttl = PING_DEF_TTL; -- 2.30.2