chiark / gitweb /
hexdecoct: use typesafe new() instead of malloc()
authorLennart Poettering <lennart@poettering.net>
Wed, 1 Feb 2017 23:10:44 +0000 (00:10 +0100)
committerSven Eden <yamakuzure@gmx.net>
Mon, 17 Jul 2017 15:58:36 +0000 (17:58 +0200)
src/basic/hexdecoct.c

index 6843aed..2d6e377 100644 (file)
@@ -72,10 +72,10 @@ int unhexchar(char c) {
 }
 
 char *hexmem(const void *p, size_t l) {
-        char *r, *z;
         const uint8_t *x;
+        char *r, *z;
 
-        z = r = malloc(l * 2 + 1);
+        z = r = new(char, l * 2 + 1);
         if (!r)
                 return NULL;