]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
contrib/mempattern mm_free(): accept const*
authorVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 9 Mar 2026 08:39:18 +0000 (09:39 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Wed, 6 May 2026 13:28:49 +0000 (15:28 +0200)
contrib/mempattern.c
contrib/mempattern.h

index e0c784de1507770183b4ee0ab634f78836d16ee1..75c397a920f53be8a9a0551f35a0eb34c43be959 100644 (file)
@@ -95,14 +95,14 @@ char *mm_strdup(knot_mm_t *mm, const char *s)
        }
 }
 
-void mm_free(knot_mm_t *mm, void *what)
+void mm_free(knot_mm_t *mm, const void *what)
 {
        if (mm) {
                if (mm->free) {
-                       mm->free(what);
+                       mm->free((void *)what);
                }
        } else {
-               free(what);
+               free_const(what);
        }
 }
 
index 105d48331eed2711fec7c1034249555eb4e79b24..da299233fd30d1cd463788b385a5a0761424339e 100644 (file)
@@ -45,7 +45,7 @@ char *mm_strdup(knot_mm_t *mm, const char *s);
 
 /*! \brief Free using 'mm' if any, uses system free() otherwise. */
 KR_EXPORT
-void mm_free(knot_mm_t *mm, void *what);
+void mm_free(knot_mm_t *mm, const void *what);
 
 /*! \brief Initialize default memory allocation context. */
 void mm_ctx_init(knot_mm_t *mm);