diff options
author | Michael McConville <mmcconville@mykolab.com> | 2015-12-08 21:16:52 -0500 |
---|---|---|
committer | Will Estes <westes575@gmail.com> | 2015-12-09 09:53:57 -0500 |
commit | d95947343e8a52957048b1d0b72c262183f2723f (patch) | |
tree | 94ece9fd39c511e1a460881e6bde7b462c804c93 /src/buf.c | |
parent | 1cc5d870326d0c574a21bbe85457bfc50d6cc43e (diff) |
Removed flex_free()i, corrected buf_destroy logic.
As with flex_alloc(), replace with direct calls to free().
The function buf_destroy is now null safe and the logic was corrected to free()
correctly.
Diffstat (limited to 'src/buf.c')
-rw-r--r-- | src/buf.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -79,7 +79,7 @@ struct Buf *buf_prints (struct Buf *buf, const char *fmt, const char *s) flexfatal (_("Allocation of buffer to print string failed")); snprintf (t, tsz, fmt, s); buf = buf_strappend (buf, t); - flex_free (t); + free(t); return buf; } @@ -107,7 +107,7 @@ struct Buf *buf_linedir (struct Buf *buf, const char* filename, int lineno) *dst++ = '\n'; *dst = '\0'; buf = buf_strappend (buf, t); - flex_free (t); + free(t); return buf; } @@ -209,9 +209,10 @@ void buf_init (struct Buf *buf, size_t elem_size) /* frees memory */ void buf_destroy (struct Buf *buf) { - if (buf && buf->elts) - flex_free (buf->elts); - buf->elts = NULL; + if (buf) { + free(buf->elts); + buf->elts = NULL; + } } |