From df24b52d8b809ab47f89221bed247e13281ca20a Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 14 Nov 2012 13:01:15 +0000 Subject: Avoid const warnings when deallocating memory In some case we allocate and assign data to a const pointer. When we then try to free it we would get a const warning because talloc_free accepts a void, not a const void pointer. Use discard_const to avoid the warning, it is safe in this case. --- src/util/util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/util/util.h') diff --git a/src/util/util.h b/src/util/util.h index 64ad0257..c15ca668 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -231,7 +231,7 @@ errno_t set_debug_file_from_fd(const int fd); #define FLAGS_PID_FILE 0x0004 #ifndef talloc_zfree -#define talloc_zfree(ptr) do { talloc_free(ptr); ptr = NULL; } while(0) +#define talloc_zfree(ptr) do { talloc_free(discard_const(ptr)); ptr = NULL; } while(0) #endif #ifndef discard_const_p -- cgit