summaryrefslogtreecommitdiff
path: root/libmisc
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-06-12 02:32:05 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-06-12 02:32:05 -0600
commit8ce568bae1cc9a77996f16b859482992d27e0b37 (patch)
tree3d88dac69ba2c9bb75bfffcda0e9df627ba0ec32 /libmisc
parent7ddc93c7084e2893cf771dc7b5c027a6303404da (diff)
parentbaa075b9d499f13ea445d1371b5338c9043a95de (diff)
Merge branch 'lukeshu/io-pread'
Diffstat (limited to 'libmisc')
-rw-r--r--libmisc/include/libmisc/alloc.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/libmisc/include/libmisc/alloc.h b/libmisc/include/libmisc/alloc.h
index afddbce..34becdb 100644
--- a/libmisc/include/libmisc/alloc.h
+++ b/libmisc/include/libmisc/alloc.h
@@ -23,4 +23,11 @@
#define heap_alloc(N, TYP) ((TYP *)calloc(N, sizeof(TYP)))
+static inline void heap_cleanup(void **ptrptr) {
+ if (!ptrptr)
+ return;
+ free(*ptrptr);
+ *ptrptr = NULL;
+}
+
#endif /* _LIBMISC_ALLOC_H_ */