From 11e0dd6c90098a31b4ee84a2af39114001952d67 Mon Sep 17 00:00:00 2001 From: uqs Date: Tue, 29 Dec 2015 11:24:41 +0000 Subject: Fix type mismatches for malloc(3) and Co. This is rather pedantic, as for most architectures it holds that sizeof(type *) == sizeof(type **) Found by: clang static analyzer Reviewed by: ed Differential Revision: https://reviews.freebsd.org/D4722 --- usr.bin/locate/locate/util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'usr.bin/locate') diff --git a/usr.bin/locate/locate/util.c b/usr.bin/locate/locate/util.c index 3ac69b5..9130e37 100644 --- a/usr.bin/locate/locate/util.c +++ b/usr.bin/locate/locate/util.c @@ -93,7 +93,7 @@ colon(dbv, path, dot) char **pv; if (dbv == NULL) { - if ((dbv = malloc(sizeof(char **))) == NULL) + if ((dbv = malloc(sizeof(char *))) == NULL) err(1, "malloc"); *dbv = NULL; } @@ -123,7 +123,7 @@ colon(dbv, path, dot) *(p + slen) = '\0'; } /* increase dbv with element p */ - if ((dbv = realloc(dbv, sizeof(char **) * (vlen + 2))) + if ((dbv = realloc(dbv, sizeof(char *) * (vlen + 2))) == NULL) err(1, "realloc"); *(dbv + vlen) = p; -- cgit v1.1