aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ens.fr>2015-02-09 22:00:47 +0100
committerAlex Auvolat <alex.auvolat@ens.fr>2015-02-09 22:00:47 +0100
commita1ebf864cc9f10f821413921f4aa5c75dcbe6f55 (patch)
tree3325b14d5ea96c8b2dfbd3ebfa5f263a5f8372a1
parent2a69b085432cd486f7ea73478393e76815f9f45d (diff)
downloadkogata-a1ebf864cc9f10f821413921f4aa5c75dcbe6f55.tar.gz
kogata-a1ebf864cc9f10f821413921f4aa5c75dcbe6f55.zip
Forgot something
-rw-r--r--src/kernel/user/nullfs.c4
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;
}