From e9fd8298776cb6cc31173ecf040817aab2d1da39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?poljar=20=28Damir=20Jeli=C4=87=29?= Date: Fri, 29 Jun 2012 23:19:52 +0200 Subject: [PATCH] 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. --- src/pulsecore/conf-parser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pulsecore/conf-parser.c b/src/pulsecore/conf-parser.c index 10b020c73..062fa8e5d 100644 --- a/src/pulsecore/conf-parser.c +++ b/src/pulsecore/conf-parser.c @@ -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;