core/collection: Fix some memory leaks
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
ffa12a2c38
commit
8e5cc543c3
|
@ -63,8 +63,8 @@ static void scan_path(void *data)
|
|||
name = g_dir_read_name(dir);
|
||||
}
|
||||
|
||||
track_db_commit();
|
||||
g_dir_close(dir);
|
||||
track_db_commit();
|
||||
delete scan;
|
||||
}
|
||||
|
||||
|
@ -180,14 +180,16 @@ void collection_remove(struct library *library)
|
|||
|
||||
void collection_update(struct library *library)
|
||||
{
|
||||
struct scan_info *scan = new struct scan_info;
|
||||
scan->library = library;
|
||||
struct scan_info *scan;
|
||||
|
||||
if (library) {
|
||||
scan->path = library->li_path;
|
||||
idle_schedule(validate_library, library);
|
||||
idle_schedule(scan_path, scan);
|
||||
}
|
||||
if (!library)
|
||||
return;
|
||||
|
||||
scan = new struct scan_info;
|
||||
scan->library = library;
|
||||
scan->path = library->li_path;
|
||||
idle_schedule(validate_library, library);
|
||||
idle_schedule(scan_path, scan);
|
||||
}
|
||||
|
||||
void collection_update_all()
|
||||
|
|
|
@ -64,6 +64,11 @@ static void test_update()
|
|||
struct queue *q = collection_get_queue();
|
||||
struct library *lib = library_get(0);
|
||||
|
||||
collection_update(NULL);
|
||||
test_equal(track_db_get()->db_size, 48);
|
||||
test_equal(lib->li_size, 48);
|
||||
test_equal(queue_size(q), 48);
|
||||
|
||||
g_rename("tests/Music/Hyrule Symphony/", "tests/Music/symphony/");
|
||||
collection_update(lib);
|
||||
|
||||
|
|
Loading…
Reference in New Issue