blob: clear buf->head when freeing a buffer
authorFelix Fietkau <nbd@nbd.name>
Thu, 10 Feb 2022 20:02:16 +0000 (21:02 +0100)
committerFelix Fietkau <nbd@nbd.name>
Thu, 10 Feb 2022 20:02:20 +0000 (21:02 +0100)
Prevents accidental silent use-after-free bugs

Signed-off-by: Felix Fietkau <nbd@nbd.name>
blob.c

diff --git a/blob.c b/blob.c
index bd66d78fee47ca4a2114e500baabcae87262491e..65adb139553f88766eb075f720a5687fe8f3ad28 100644 (file)
--- a/blob.c
+++ b/blob.c
@@ -105,6 +105,7 @@ blob_buf_free(struct blob_buf *buf)
 {
        free(buf->buf);
        buf->buf = NULL;
+       buf->head = NULL;
        buf->buflen = 0;
 }