Skip to content

Commit

Permalink
Must allocate some memory for structs
Browse files Browse the repository at this point in the history
  • Loading branch information
benlangfeld committed Jan 7, 2014
1 parent 0fd2d6c commit 551c397
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cspeech/nlsml.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 551c397

Please sign in to comment.