aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-08-02 17:40:24 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-08-02 17:40:24 -0700
commitaaa318f80c573b88ce67e80e568166e2a0f741e3 (patch)
tree0c664ba33e1920cf7fb02391112248699a04c97d
parent71beeca0edbae0cd7bd92b55752b016d0b5d676f (diff)
downloadbak.git-aaa318f80c573b88ce67e80e568166e2a0f741e3.tar.gz
bak.git-aaa318f80c573b88ce67e80e568166e2a0f741e3.tar.xz
bak.git-aaa318f80c573b88ce67e80e568166e2a0f741e3.zip
file: clear fp->i.buf when the buffer is freed
To make debugging easier, when we free fp->i.buf, we also want to clear it. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--com32/lib/sys/fileclose.c1
-rw-r--r--com32/lib/sys/stdcon_read.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/com32/lib/sys/fileclose.c b/com32/lib/sys/fileclose.c
index bbf6077d..7b7d0791 100644
--- a/com32/lib/sys/fileclose.c
+++ b/com32/lib/sys/fileclose.c
@@ -50,6 +50,7 @@ int __file_close(struct file_info *fp)
}
free(fp->i.buf);
+ fp->i.buf = NULL;
return 0;
}
diff --git a/com32/lib/sys/stdcon_read.c b/com32/lib/sys/stdcon_read.c
index 8d8150dd..079c91fe 100644
--- a/com32/lib/sys/stdcon_read.c
+++ b/com32/lib/sys/stdcon_read.c
@@ -51,6 +51,7 @@ static ssize_t __stdcon_open(struct file_info *fp)
static int __stdcon_close(struct file_info *fp)
{
free(fp->i.buf);
+ fp->i.buf = NULL;
}
static ssize_t __stdcon_read(struct file_info *fp, void *buf, size_t count)