Commit 15d4c841 authored by Max Kellermann's avatar Max Kellermann

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.
parent 5b9dfbe3
ver 0.15.1 (2009/??/??) ver 0.15.1 (2009/??/??)
* commands: * commands:
- don't resume playback when stopping during pause - don't resume playback when stopping during pause
* database: fixed NULL pointer dereference after charset change
ver 0.15 (2009/06/23) ver 0.15 (2009/06/23)
......
...@@ -318,10 +318,11 @@ db_load(GError **error) ...@@ -318,10 +318,11 @@ db_load(GError **error)
if (old_charset != NULL if (old_charset != NULL
&& strcmp(new_charset, old_charset)) { && strcmp(new_charset, old_charset)) {
fclose(fp); fclose(fp);
g_message("Existing database has charset \"%s\" " g_set_error(error, db_quark(), 0,
"instead of \"%s\"; " "Existing database has charset "
"discarding database file", "\"%s\" instead of \"%s\"; "
new_charset, old_charset); "discarding database file",
new_charset, old_charset);
return false; return false;
} }
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment