Mailing List Archive

[6891] cherokee/trunk/cherokee/handler_ssi.c: Fixes a few (minor) memory leaks in the SSI handler.
Revision: 6891
http://svn.cherokee-project.com/changeset/6891
Author: alo
Date: 2011-10-07 23:01:39 +0200 (Fri, 07 Oct 2011)
Log Message:
-----------
Fixes a few (minor) memory leaks in the SSI handler.

Modified Paths:
--------------
cherokee/trunk/cherokee/handler_ssi.c

Modified: cherokee/trunk/cherokee/handler_ssi.c
===================================================================
--- cherokee/trunk/cherokee/handler_ssi.c 2011-10-07 21:01:36 UTC (rev 6890)
+++ cherokee/trunk/cherokee/handler_ssi.c 2011-10-07 21:01:39 UTC (rev 6891)
@@ -102,6 +102,7 @@

UNUSED(srv);
UNUSED(conf);
+ UNUSED(props);

if (*_props == NULL) {
CHEROKEE_NEW_STRUCT (n, handler_ssi_props);
@@ -196,12 +197,15 @@
p = strstr (q, "<!--#");
if (p == NULL) {
cherokee_buffer_add (out, begin, (in->buf + in->len) - begin);
- return ret_ok;
+ ret = ret_ok;
+ goto out;
}

q = strstr (p + 5, "-->");
- if (q == NULL)
- return ret_error;
+ if (q == NULL) {
+ ret = ret_error;
+ goto out;
+ }

len = q - p;
len -= 5;
@@ -318,7 +322,8 @@
ret = cherokee_buffer_read_file (&file_content, fpath.buf);
if (unlikely (ret != ret_ok)) {
cherokee_buffer_mrproper (&file_content);
- return ret_error;
+ ret = ret_error;
+ goto out;
}

TRACE(ENTRIES, "Including file '%s'\n", fpath.buf);
@@ -326,7 +331,8 @@
ret = parse (hdl, &file_content, out);
if (unlikely (ret != ret_ok)) {
cherokee_buffer_mrproper (&file_content);
- return ret_error;
+ ret = ret_error;
+ goto out;
}

cherokee_buffer_mrproper (&file_content);
@@ -367,7 +373,15 @@
} /* switch(op) */
} /* while */

- return ret_ok;
+ ret = ret_ok;
+
+out:
+ cherokee_buffer_mrproper (&key);
+ cherokee_buffer_mrproper (&val);
+ cherokee_buffer_mrproper (&pair);
+ cherokee_buffer_mrproper (&fpath);
+
+ return ret;
}