Permalink
Browse files

"Possible memory leak. Dynamic memory stored in 'n' allocated through

function 'malloc' at line 868 can be lost at line 891" (Klocwork.com
Issue #43)

git-svn-id: svn://cherokee-project.com/cherokee/trunk@6680 5dc97367-97f1-0310-9951-d761b3857238
  • Loading branch information...
1 parent 1418874 commit cd3d92208e3f9c954bbcb4e21f908aa2e6a11af5 @alobbs alobbs committed May 22, 2011
Showing with 7 additions and 3 deletions.
  1. +7 −3 cherokee/handler_server_info.c
@@ -884,21 +884,25 @@ cherokee_handler_server_info_new (cherokee_handler_t **hdl,
*/
ret = cherokee_buffer_init (&n->buffer);
if (unlikely(ret != ret_ok))
- return ret;
+ goto error;
ret = cherokee_buffer_ensure_size (&n->buffer, 4*1024);
if (unlikely(ret != ret_ok))
- return ret;
+ goto error;
ret = cherokee_dwriter_init (&n->writer, &CONN_THREAD(cnt)->tmp_buf1);
if (unlikely(ret != ret_ok))
- return ret;
+ goto error;
n->writer.pretty = true;
cherokee_dwriter_set_buffer (&n->writer, &n->buffer);
*hdl = HANDLER(n);
return ret_ok;
+
+error:
+ cherokee_handler_free (HANDLER(n));
+ return ret_error;
}

0 comments on commit cd3d922

Please sign in to comment.