aboutsummaryrefslogtreecommitdiffstats
path: root/src/database.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-06-30 16:29:40 +0200
committerMax Kellermann <max@duempel.org>2009-06-30 16:29:40 +0200
commit15d4c841ce8b5b387850d710999c623b038910fa (patch)
tree396305325b9415cae7512684f778e1f7933bbed8 /src/database.c
parent5b9dfbe3539ba3d7d1d2962f1f888c4bd90755fa (diff)
downloadmpd-15d4c841ce8b5b387850d710999c623b038910fa.tar.gz
mpd-15d4c841ce8b5b387850d710999c623b038910fa.tar.xz
mpd-15d4c841ce8b5b387850d710999c623b038910fa.zip
database: fixed NULL pointer dereference after charset change
When the filesystem_charset is changed in mpd.conf, MPD should discard the old database. In this error branch, MPD did not fill the GError object properly, and logged a warning message instead, which caused a segmentation fault.
Diffstat (limited to '')
-rw-r--r--src/database.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/database.c b/src/database.c
index 7257930bc..5a06dda98 100644
--- a/src/database.c
+++ b/src/database.c
@@ -318,10 +318,11 @@ db_load(GError **error)
if (old_charset != NULL
&& strcmp(new_charset, old_charset)) {
fclose(fp);
- g_message("Existing database has charset \"%s\" "
- "instead of \"%s\"; "
- "discarding database file",
- new_charset, old_charset);
+ g_set_error(error, db_quark(), 0,
+ "Existing database has charset "
+ "\"%s\" instead of \"%s\"; "
+ "discarding database file",
+ new_charset, old_charset);
return false;
}
} else {