summaryrefslogtreecommitdiff
path: root/src/readahead
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-04-22 23:12:15 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-04-24 00:25:04 -0400
commitef42202ac8ed27e7ff1fc90ef8bc2590046dff25 (patch)
treeb1646eeb8ef5070337ae701ffb4abf0e398640ad /src/readahead
parentc79bb9e4e2e5b96b2ae2c432bf8b0ff9674fce60 (diff)
Add set_consume which always takes ownership
Freeing in error path is the common pattern with set_put().
Diffstat (limited to 'src/readahead')
-rw-r--r--src/readahead/readahead-collect.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/readahead/readahead-collect.c b/src/readahead/readahead-collect.c
index 75ec5b70c7..ccd8408c1b 100644
--- a/src/readahead/readahead-collect.c
+++ b/src/readahead/readahead-collect.c
@@ -479,8 +479,9 @@ static int collect(const char *root) {
}
entry->bin = (entrytime - starttime) / 2000000;
- if ((k = hashmap_put(files, p, entry)) < 0) {
- log_warning("set_put() failed: %s", strerror(-k));
+ k = hashmap_put(files, p, entry);
+ if (k < 0) {
+ log_warning("hashmap_put() failed: %s", strerror(-k));
free(p);
}
}