From a1ebf864cc9f10f821413921f4aa5c75dcbe6f55 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Mon, 9 Feb 2015 22:00:47 +0100 Subject: Forgot something --- src/kernel/user/nullfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/kernel/user/nullfs.c b/src/kernel/user/nullfs.c index 5c6be94..79611ab 100644 --- a/src/kernel/user/nullfs.c +++ b/src/kernel/user/nullfs.c @@ -254,8 +254,10 @@ size_t nullfs_i_ram_write(void* fi, size_t offset, size_t len, const char* buf) memcpy(new_buffer, f->data, f->size); if (offset > f->size) memset(new_buffer + f->size, 0, offset - f->size); - free(f->data); + + if (f->data_owned) free(f->data); f->data = new_buffer; + f->data_owned = true; f->size = offset + len; } -- cgit v1.2.3