From 3dd6e6bcb536f5fc591073e062232f30fe048245 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Fri, 11 Apr 2014 13:17:57 +1000 Subject: [PATCH] Provide a dealloc function --- src/libckpool.c | 6 ++++++ src/libckpool.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/libckpool.c b/src/libckpool.c index f4b7a1f8..c42876ba 100644 --- a/src/libckpool.c +++ b/src/libckpool.c @@ -422,6 +422,12 @@ void realloc_strcat(char **ptr, const char *s) sprintf(ofs, "%s", s); } +void dealloc(void **ptr) +{ + free(*ptr); + *ptr = NULL; +} + /* Adequate size s==len*2 + 1 must be alloced to use this variant */ void __bin2hex(uchar *s, const uchar *p, size_t len) { diff --git a/src/libckpool.h b/src/libckpool.h index 3ad47866..5eec0913 100644 --- a/src/libckpool.h +++ b/src/libckpool.h @@ -141,6 +141,7 @@ int connect_socket(char *url, char *port); void align_len(size_t *len); void realloc_strcat(char **ptr, const char *s); +void dealloc(void **ptr); void __bin2hex(uchar *s, const uchar *p, size_t len); void *bin2hex(const uchar *p, size_t len); bool hex2bin(uchar *p, const uchar *hexstr, size_t len);