[pulseaudio-discuss] [PATCH] conf-parser: Initialize the state to zero immediately.

poljar (Damir Jelić) poljarinho at gmail.com
Fri Jun 29 14:19:52 PDT 2012


From: "poljar (Damir Jelić)" <poljarinho at gmail.com>

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pulsecore/conf-parser.c b/src/pulsecore/conf-parser.c
index 10b020c..acaf7b8 100644
--- a/src/pulsecore/conf-parser.c
+++ b/src/pulsecore/conf-parser.c
@@ -159,6 +159,7 @@ int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, pa_p
     int r = -1;
     pa_bool_t do_close = !f;
     pa_config_parser_state state;
+    pa_zero(state);
 
     pa_assert(filename);
     pa_assert(t);
@@ -174,7 +175,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;
-- 
1.7.11.1



More information about the pulseaudio-discuss mailing list