diff buffer.c @ 1912:8b4274d34fe8

Use buf_burn_free() instead of two calls
author Matt Johnston <matt@ucc.asn.au>
date Tue, 29 Mar 2022 23:47:30 +0800
parents 290caf301a4f
children
line wrap: on
line diff
--- a/buffer.c	Tue Mar 29 23:27:55 2022 +0800
+++ b/buffer.c	Tue Mar 29 23:47:30 2022 +0800
@@ -55,11 +55,13 @@
 	m_free(buf);
 }
 
-/* overwrite the contents of the buffer to clear it */
-void buf_burn(const buffer* buf) {
+/* overwrite the contents of the buffer then free it */
+void buf_burn_free(buffer* buf) {
 	m_burn(buf->data, buf->size);
+	m_free(buf);
 }
 
+
 /* resize a buffer, pos and len will be repositioned if required when
  * downsizing */
 buffer* buf_resize(buffer *buf, unsigned int newsize) {