summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2018-02-15 13:21:38 +0200
committerSergey Poznyakoff <gray@gnu.org>2018-02-15 13:23:48 +0200
commit1d7a04a00b052f4ab52ab4c6b9007c27f2f3018a (patch)
tree995d1c858fc2fb2ffe825b750154575634cb21a6 /src
parent39691861000586efaf0f6fdead742f73c7c734a3 (diff)
downloadfileserv-1d7a04a00b052f4ab52ab4c6b9007c27f2f3018a.tar.gz
fileserv-1d7a04a00b052f4ab52ab4c6b9007c27f2f3018a.tar.bz2
Fix memory leak
* src/idx.c (next_escape_node): Remove unnecessary memory allocation.
Diffstat (limited to 'src')
-rw-r--r--src/idx.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/idx.c b/src/idx.c
index bd1286f..be5b87c 100644
--- a/src/idx.c
+++ b/src/idx.c
@@ -111,7 +111,6 @@ parse_cond(struct template_state *st, int brn, size_t off, size_t len)
static INDEX_NODE *
next_escape_node(struct template_state *st)
{
- INDEX_NODE *np;
size_t len;
st->start = st->cur + 2;
@@ -123,7 +122,6 @@ next_escape_node(struct template_state *st)
st->cur++;
}
- np = xmalloc(sizeof(*np));
if (st->escape) {
st->escape = 0;
return new_text_node(NODE_TEXT, st->start,
@@ -140,6 +138,8 @@ next_escape_node(struct template_state *st)
st->cur += 2;
if (memcmp(st->start, "loop", len) == 0) {
+ INDEX_NODE *np;
+
assert(st->loop == 0);
st->loop = 1;
np = xmalloc(sizeof(*np));
@@ -169,6 +169,7 @@ next_escape_node(struct template_state *st)
if (memcmp(st->start, "else", len) == 0) {
+ INDEX_NODE *np;
struct condition *cond = STAILQ_FIRST(&st->cond);
assert(cond);
np = cond->node;

Return to:

Send suggestions and report system problems to the System administrator.