summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2013-06-03 17:32:46 +0200
committerYorhel <git@yorhel.nl>2013-06-03 17:32:46 +0200
commit0b51247c93aac72c29657807640e11388b6f706a (patch)
tree5a2d82b3b784c20077a3bf7ff0934f40195aeab8
parentf5ffccfaa8303e814f65bac49aa59657d65f1971 (diff)
share/scan: Fix memory leak and an if condition bug
-rw-r--r--src/share/scan.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/share/scan.c b/src/share/scan.c
index 4d29f4b..5784ff1 100644
--- a/src/share/scan.c
+++ b/src/share/scan.c
@@ -138,7 +138,7 @@ static share_fl_t *share_scan_thread_item(share_scan_work_t *w, const char *fnam
}
fl = share_fl_create(S_ISDIR(st.st_mode) ? UINT64_MAX : (uint64_t)st.st_size, fname, buf);
- if(fl->size == UINT64_MAX) {
+ if(fl->size != UINT64_MAX) {
fl->lastmod = st.st_mtime;
fl->pathid = w->pathid;
}
@@ -175,6 +175,7 @@ static share_flv_t share_scan_thread_readdir(share_scan_work_t *w) {
ywarn("Error reading file list from '%s': %s", w->fspath, strerror(olderrno ? olderrno : errno));
}
+ free(buf.s);
return lst;
}