diff options
author | Martin Storsjö <martin@martin.st> | 2019-02-18 12:00:55 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2019-02-19 10:05:42 +0100 |
commit | ec0de4afa8f6119a737f731433134bed4fc48f32 (patch) | |
tree | fc0e40f32ec6b4e46ed7b1db224232b96cf590fa | |
parent | 8e021a46ee2d455c8c677a7eb982b56c3c408942 (diff) |
dir_scan: Avoid allocating new copies of buf_dir
This allocation is currently leaked, but as long as we don't allocate
new ones for each refresh, that shouldn't be much of an issue.
(cherry picked from commit 9dc2d32a8fb557112f8f96cd14d50b934543ce39)
-rw-r--r-- | src/dir_scan.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/dir_scan.c b/src/dir_scan.c index 9483d01..442c4a2 100644 --- a/src/dir_scan.c +++ b/src/dir_scan.c @@ -312,6 +312,7 @@ void dir_scan_init(const char *path) { dir_setlasterr(NULL); dir_seterr(NULL); dir_process = process; - buf_dir = malloc(dir_memsize("")); + if (!buf_dir) + buf_dir = malloc(dir_memsize("")); pstate = ST_CALC; } |