aboutsummaryrefslogtreecommitdiff
path: root/strbuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'strbuf.c')
-rw-r--r--strbuf.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/strbuf.c b/strbuf.c
index 7a53a52..a850d41 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -99,12 +99,16 @@ static inline void debug_stats(strbuf_t *s)
99 } 99 }
100} 100}
101 101
102/* If strbuf_t has not been dynamically allocated, strbuf_free() can
103 * be called any number of times strbuf_init() */
102void strbuf_free(strbuf_t *s) 104void strbuf_free(strbuf_t *s)
103{ 105{
104 debug_stats(s); 106 debug_stats(s);
105 107
106 if (s->buf) 108 if (s->buf) {
107 free(s->buf); 109 free(s->buf);
110 s->buf = NULL;
111 }
108 if (s->dynamic) 112 if (s->dynamic)
109 free(s); 113 free(s);
110} 114}