From 551c3977519f3e28676bdcf161360b079b84fc30 Mon Sep 17 00:00:00 2001 From: Ben Langfeld Date: Tue, 7 Jan 2014 19:22:11 -0200 Subject: [PATCH] Must allocate some memory for structs See #3 --- cspeech/nlsml.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cspeech/nlsml.cc b/cspeech/nlsml.cc index 984e3bc..365dd38 100644 --- a/cspeech/nlsml.cc +++ b/cspeech/nlsml.cc @@ -96,7 +96,7 @@ struct nlsml_parser { */ static struct tag_def *add_tag_def(const char *tag, tag_attribs_fn attribs_fn, tag_cdata_fn cdata_fn, const char *children_tags) { - struct tag_def *def; + struct tag_def *def = (struct tag_def *) malloc(sizeof(tag_def)); if (!cspeech_zstr(children_tags)) { std::string tags_string(children_tags); std::stringstream ss(tags_string); @@ -259,7 +259,7 @@ static int tag_hook(void *user_data, char *name, char **atts, int type) struct nlsml_parser *parser = (struct nlsml_parser *)user_data; if (type == IKS_OPEN || type == IKS_SINGLE) { - struct nlsml_node *child_node; + struct nlsml_node *child_node = (struct nlsml_node *) malloc(sizeof(*child_node)); child_node->name = name; child_node->tag_def = globals.tag_defs[name]; if (!child_node->tag_def) {