]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix testbound for alloc stats strdup in util/alloc.c.
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Fri, 2 Aug 2024 06:58:22 +0000 (08:58 +0200)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Fri, 2 Aug 2024 06:58:22 +0000 (08:58 +0200)
testcode/testbound.c
util/alloc.c

index f023860e086e9be8dd5a50db20584567a775b1d6..123fe0d4e46f4e510a13db2ae0ac82b34b865e35 100644 (file)
@@ -72,23 +72,6 @@ int daemon_main(int argc, char* argv[]);
 /** config files (removed at exit) */
 static struct config_strlist* cfgfiles = NULL;
 
-#ifdef UNBOUND_ALLOC_STATS
-#  define strdup(s) unbound_stat_strdup_log(s, __FILE__, __LINE__, __func__)
-char* unbound_stat_strdup_log(char* s, const char* file, int line,
-       const char* func);
-char* unbound_stat_strdup_log(char* s, const char* file, int line,
-        const char* func) {
-       char* result;
-       size_t len;
-       if(!s) return NULL;
-       len = strlen(s);
-       log_info("%s:%d %s strdup(%u)", file, line, func, (unsigned)len+1);
-       result = unbound_stat_malloc(len+1);
-       memmove(result, s, len+1);
-       return result;
-}
-#endif /* UNBOUND_ALLOC_STATS */
-
 /** give commandline usage for testbound. */
 static void
 testbound_usage(void)
index d00976b7fa5eb23bf1cae69fdf4531413d522252..a6c91180356e0a01521122136c4e5c13d2bbc864 100644 (file)
@@ -475,8 +475,7 @@ char *unbound_stat_strdup(const char* s)
        len = strlen(s);
        res = unbound_stat_malloc(len+1);
        if(!res) return NULL;
-       memmove(res, s, len);
-       res[len]=0;
+       memmove(res, s, len+1);
        return res;
 }