summaryrefslogtreecommitdiff
path: root/libmisc
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-06-07 20:07:10 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-06-12 02:28:40 -0600
commit1affc79a60fa433f753cb5e70fc2f2ba274e60a3 (patch)
treedae5f31c00c2a4ca818ab44e2cac178afc48366d /libmisc
parent7ddc93c7084e2893cf771dc7b5c027a6303404da (diff)
lib9p_srv: Clean up the handle_Tread() implementation
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_ */