Just like libvirt has it. After freeing pointer set it to NULL to
avoid double frees.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/util.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/util.h b/src/util.h
index fcd4075..3af77d4 100644
--- a/src/util.h
+++ b/src/util.h
@@ -36,6 +36,12 @@
# define DPRINTF(fmt, ...) \
debugPrint(debugSource, fmt, __VA_ARGS__)
+# define VIR_FREE(ptr) \
+ do { \
+ free(ptr); \
+ ptr = NULL; \
+ } while (0)
+
# define ARRAY_CARDINALITY(array) (sizeof(array) / sizeof(array[0]))
# define IS_BIGENDIAN (*(uint16_t *)"\0\xff" < 0x100)
--
2.13.6