aboutsummaryrefslogtreecommitdiffstats
path: root/src/reader.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-12-12 01:19:44 +0000
committerDavid Robillard <d@drobilla.net>2011-12-12 01:19:44 +0000
commitd5dd73fda168592f0b293657d78625c884d19764 (patch)
treea150259687f9a96570e9c84e39b50738a2d00543 /src/reader.c
parent00547a842e11b79ed3a044d91959c0878c20a6c4 (diff)
downloadserd-d5dd73fda168592f0b293657d78625c884d19764.tar.gz
serd-d5dd73fda168592f0b293657d78625c884d19764.tar.bz2
serd-d5dd73fda168592f0b293657d78625c884d19764.zip
Fix memory error introduced a few commits ago.
git-svn-id: http://svn.drobilla.net/serd/trunk@247 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src/reader.c')
-rw-r--r--src/reader.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/reader.c b/src/reader.c
index da70e6db..c1c2a1bd 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -115,11 +115,14 @@ page(SerdReader* reader)
assert(reader->from_file);
reader->read_head = 0;
const size_t n_read = fread(reader->read_buf, 1, SERD_PAGE_SIZE, reader->fd);
- reader->read_buf[n_read] = '\0';
if (n_read == 0) {
+ reader->read_buf[0] = '\0';
reader->eof = true;
+ return false;
+ } else if (n_read < SERD_PAGE_SIZE) {
+ reader->read_buf[n_read] = '\0';
}
- return !reader->eof;
+ return true;
}
static inline bool