diff options
Diffstat (limited to 'lib/roken/dumpdata.c')
-rw-r--r-- | lib/roken/dumpdata.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/roken/dumpdata.c b/lib/roken/dumpdata.c index 844360187f87..252744e28e2f 100644 --- a/lib/roken/dumpdata.c +++ b/lib/roken/dumpdata.c @@ -81,14 +81,16 @@ rk_undumpdata(const char *filename, void **buf, size_t *size) sret = net_read(fd, *buf, *size); if (sret < 0) ret = errno; - else if (sret != (ssize_t)*size) { + else if (sret != (ssize_t)*size) ret = EINVAL; - free(*buf); - *buf = NULL; - } else + else ret = 0; - out: + out: + if (ret) { + free(*buf); + *buf = NULL; + } close(fd); return ret; } |