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.
This commit is contained in:
Max Kellermann 2009-06-30 16:29:40 +02:00
parent 5b9dfbe353
commit 15d4c841ce
2 changed files with 6 additions and 4 deletions

1
NEWS
View File

@ -1,6 +1,7 @@
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)

View File

@ -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 {