conf-parser: Initialize the state to zero immediately.

Set the state variable immediately to zero so if we fail to open the
configuration file we don't check an uninitialized pointer and free an
nonexistent proplist.
This commit is contained in:
poljar (Damir Jelić) 2012-06-29 23:19:52 +02:00 committed by Tanu Kaskinen
parent 8239fca09f
commit e9fd829877

View file

@ -163,6 +163,8 @@ int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, pa_p
pa_assert(filename);
pa_assert(t);
pa_zero(state);
if (!f && !(f = pa_fopen_cloexec(filename, "r"))) {
if (errno == ENOENT) {
pa_log_debug("Failed to open configuration file '%s': %s", filename, pa_cstrerror(errno));
@ -174,7 +176,6 @@ int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, pa_p
goto finish;
}
pa_zero(state);
state.filename = filename;
state.item_table = t;
state.userdata = userdata;