diff options
author | Eric Wong <normalperson@yhbt.net> | 2008-10-11 21:46:00 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-10-12 05:27:32 -0700 |
commit | 3e652ee92d4bbe2a9e68cc80b6d58a7f0e6a6093 (patch) | |
tree | 44c02b1193ee8448128c38fdac49cef1964a04a5 /src/update.c | |
parent | 0fd45f50ec56bcfacae3f6f141ea804b9ac3493f (diff) | |
download | mpd-3e652ee92d4bbe2a9e68cc80b6d58a7f0e6a6093.tar.gz mpd-3e652ee92d4bbe2a9e68cc80b6d58a7f0e6a6093.tar.xz mpd-3e652ee92d4bbe2a9e68cc80b6d58a7f0e6a6093.zip |
update: validate in command.c and fix small memory leak
If update_task was called with "" as its path argument, that
string would never get freed because it false positived.
Instead, never pass "" to update_task and trip an assertion
if we do.
Diffstat (limited to 'src/update.c')
-rw-r--r-- | src/update.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/update.c b/src/update.c index 72f4b943b..6c8b6e7bc 100644 --- a/src/update.c +++ b/src/update.c @@ -349,9 +349,12 @@ static void updatePath(const char *utf8path) static void * update_task(void *_path) { - if (_path && !path_is_music_root(_path)) { - updatePath(_path); - free(_path); + char *utf8path = _path; + + if (utf8path) { + assert(*utf8path); + updatePath(utf8path); + free(utf8path); } else { struct stat st; @@ -386,6 +389,8 @@ unsigned directory_update_init(char *path) { assert(pthread_equal(pthread_self(), main_task)); + assert(!path || (path && *path)); + if (progress != UPDATE_PROGRESS_IDLE) { unsigned next_task_id; |