diff options
Diffstat (limited to 'src/kernel/user/nullfs.c')
-rw-r--r-- | src/kernel/user/nullfs.c | 4 |
1 files changed, 3 insertions, 1 deletions
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; } |