]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix add reallocarray to alloc stats unit test, and disable release-1.22.0rc1
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 10 Oct 2024 08:43:23 +0000 (10:43 +0200)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 10 Oct 2024 08:43:23 +0000 (10:43 +0200)
  override of strdup in unbound-host, and the result of config
  get option is freed properly.

config.h.in
configure.ac
doc/Changelog
smallapp/unbound-host.c
util/alloc.c

index b3a94fb34cb44ac41438de3805f971126c769577..dc03e82dddbaa21e13fff68f8908ec94f986698b 100644 (file)
@@ -1584,6 +1584,9 @@ struct sockaddr_storage;
 #  define free(p) unbound_stat_free_log(p, __FILE__, __LINE__, __func__)
 #  define realloc(p,s) unbound_stat_realloc_log(p, s, __FILE__, __LINE__, __func__)
 #  define strdup(s) unbound_stat_strdup_log(s, __FILE__, __LINE__, __func__)
+#ifdef HAVE_REALLOCARRAY
+#  define reallocarray(p,n,s) unbound_stat_reallocarray_log(p, n, s, __FILE__, __LINE__, __func__)
+#endif
 void *unbound_stat_malloc(size_t size);
 void *unbound_stat_calloc(size_t nmemb, size_t size);
 void unbound_stat_free(void *ptr);
@@ -1596,6 +1599,8 @@ void unbound_stat_free_log(void *ptr, const char* file, int line,
        const char* func);
 void *unbound_stat_realloc_log(void *ptr, size_t size, const char* file,
        int line, const char* func);
+void *unbound_stat_reallocarray_log(void *ptr, size_t nmemb, size_t size,
+       const char* file, int line, const char* func);
 char *unbound_stat_strdup_log(const char *s, const char* file, int line,
        const char* func);
 #elif defined(UNBOUND_ALLOC_LITE)
index a2d9d724b3f7660d14be13c004aea870e1501135..3f5759f5873cd9effabd9cb02360663f87ac8eab 100644 (file)
@@ -2392,6 +2392,9 @@ struct sockaddr_storage;
 #  define free(p) unbound_stat_free_log(p, __FILE__, __LINE__, __func__)
 #  define realloc(p,s) unbound_stat_realloc_log(p, s, __FILE__, __LINE__, __func__)
 #  define strdup(s) unbound_stat_strdup_log(s, __FILE__, __LINE__, __func__)
+#ifdef HAVE_REALLOCARRAY
+#  define reallocarray(p,n,s) unbound_stat_reallocarray_log(p, n, s, __FILE__, __LINE__, __func__)
+#endif
 void *unbound_stat_malloc(size_t size);
 void *unbound_stat_calloc(size_t nmemb, size_t size);
 void unbound_stat_free(void *ptr);
@@ -2404,6 +2407,8 @@ void unbound_stat_free_log(void *ptr, const char* file, int line,
        const char* func);
 void *unbound_stat_realloc_log(void *ptr, size_t size, const char* file,
        int line, const char* func);
+void *unbound_stat_reallocarray_log(void *ptr, size_t nmemb, size_t size,
+       const char* file, int line, const char* func);
 char *unbound_stat_strdup_log(const char *s, const char* file, int line,
        const char* func);
 #elif defined(UNBOUND_ALLOC_LITE)
index 9aa70e15e035f89eae253789944f807266dc6e01..e88b887b8ca08c3653f9c2275e7b8a3a533ee048 100644 (file)
@@ -1,6 +1,9 @@
 10 October 2024: Wouter
        - Fix cookie_file test sporadic fails for time change during
          the test.
+       - Fix add reallocarray to alloc stats unit test, and disable
+         override of strdup in unbound-host, and the result of config
+         get option is freed properly.
 
 9 October 2024: Wouter
        - Merge #871: DNS over QUIC. This adds `quic-port: 853` and
index 8bffe46ced55c3455dfd140f2e939947b280567f..edca6b9a37324bc6bfb7484133e616a32edfcec8 100644 (file)
@@ -50,6 +50,8 @@
 #undef calloc
 #undef free
 #undef realloc
+#undef reallocarray
+#undef strdup
 #endif
 #ifdef UNBOUND_ALLOC_LITE
 #undef malloc
@@ -492,7 +494,11 @@ int main(int argc, char* argv[])
                if(strcmp(use_syslog, "yes") == 0) /* disable use-syslog */
                        check_ub_res(ub_ctx_set_option(ctx, 
                                "use-syslog:", "no"));
+#ifdef UNBOUND_ALLOC_STATS
+               unbound_stat_free_log(use_syslog, __FILE__, __LINE__, __func__);
+#else
                free(use_syslog);
+#endif
        }
        argc -= optind;
        argv += optind;
index a6c91180356e0a01521122136c4e5c13d2bbc864..9a99246f589c2aee62c7b88c8e82f7d994f8b3ed 100644 (file)
@@ -519,6 +519,15 @@ void *unbound_stat_realloc_log(void *ptr, size_t size, const char* file,
        return unbound_stat_realloc(ptr, size);
 }
 
+/** log to file where alloc was done */
+void *unbound_stat_reallocarray_log(void *ptr, size_t nmemb, size_t size,
+       const char* file, int line, const char* func)
+{
+       log_info("%s:%d %s reallocarray(%p, %u, %u)", file, line, func,
+               ptr, (unsigned)nmemb, (unsigned)size);
+       return unbound_stat_realloc(ptr, nmemb*size);
+}
+
 /** log to file where strdup was done */
 char *unbound_stat_strdup_log(const char *s, const char* file, int line,
        const char* func)