diff options
| author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2015-04-19 01:17:54 -0300 | 
|---|---|---|
| committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2015-04-19 01:17:54 -0300 | 
| commit | 86b551fdf2a8bf5c6e3cebcc463ee830d65ced94 (patch) | |
| tree | 2ea95245b5d1e82d8a7197206e2b640aa54119aa /src/template-parser.c | |
| parent | fbc22f39090802845c3a046c3e10bae63d6af6cc (diff) | |
| download | blogc-86b551fdf2a8bf5c6e3cebcc463ee830d65ced94.tar.gz blogc-86b551fdf2a8bf5c6e3cebcc463ee830d65ced94.tar.bz2 blogc-86b551fdf2a8bf5c6e3cebcc463ee830d65ced94.zip | |
safe mallocs are better :)
Diffstat (limited to 'src/template-parser.c')
| -rw-r--r-- | src/template-parser.c | 6 | 
1 files changed, 3 insertions, 3 deletions
| diff --git a/src/template-parser.c b/src/template-parser.c index d176288..99e17d3 100644 --- a/src/template-parser.c +++ b/src/template-parser.c @@ -70,7 +70,7 @@ blogc_template_parse(const char *src, size_t src_len, blogc_error_t **err)              case TEMPLATE_START:                  if (last) { -                    stmt = malloc(sizeof(blogc_template_stmt_t)); +                    stmt = b_malloc(sizeof(blogc_template_stmt_t));                      stmt->type = type;                      stmt->value = b_strndup(src + start, src_len - start);                      stmts = b_slist_append(stmts, stmt); @@ -89,7 +89,7 @@ blogc_template_parse(const char *src, size_t src_len, blogc_error_t **err)                      else                          state = TEMPLATE_VARIABLE_START;                      if (end > start) { -                        stmt = malloc(sizeof(blogc_template_stmt_t)); +                        stmt = b_malloc(sizeof(blogc_template_stmt_t));                          stmt->type = type;                          stmt->value = b_strndup(src + start, end - start);                          stmts = b_slist_append(stmts, stmt); @@ -313,7 +313,7 @@ blogc_template_parse(const char *src, size_t src_len, blogc_error_t **err)              case TEMPLATE_CLOSE_BRACKET:                  if (c == '}') { -                    stmt = malloc(sizeof(blogc_template_stmt_t)); +                    stmt = b_malloc(sizeof(blogc_template_stmt_t));                      stmt->type = type;                      stmt->value = NULL;                      if (end > start) | 
