Skip to content
This repository
Browse code

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

function 'malloc' at line 604 can be lost at line 622. Also there is
one similar error on line 626." (Klocwork.com Issue #59)

git-svn-id: svn://cherokee-project.com/cherokee/trunk@6685 5dc97367-97f1-0310-9951-d761b3857238
  • Loading branch information...
commit 2e1e6937662b0ad45585f44dccceaa3e41cfa914 1 parent 369cfd2
Alvaro Lopez Ortega authored May 22, 2011

Showing 1 changed file with 7 additions and 3 deletions. Show diff stats Hide diff stats

  1. 10  cherokee/logger_custom.c
10  cherokee/logger_custom.c
@@ -619,18 +619,18 @@ cherokee_logger_custom_new (cherokee_logger_t         **logger,
619 619
 	ret = cherokee_config_node_get (config, "access", &subconf);
620 620
 	if (ret != ret_ok) {
621 621
 		LOG_CRITICAL (CHEROKEE_ERROR_LOGGER_NO_KEY, "access");
622  
-		return ret_error;
  622
+		goto error;
623 623
 	}
624 624
 	ret = cherokee_server_get_log_writer (VSERVER_SRV(vsrv), subconf, &n->writer_access);
625 625
 	if (ret != ret_ok) {
626  
-		return ret_error;
  626
+		goto error;
627 627
 	}
628 628
 
629 629
 	/* Template
630 630
 	 */
631 631
 	ret = _init_template (n, &n->template_conn, config, "access_template");
632 632
 	if (ret != ret_ok) {
633  
-		return ret;
  633
+		goto error;
634 634
 	}
635 635
 
636 636
 	/* Callback init
@@ -644,6 +644,10 @@ cherokee_logger_custom_new (cherokee_logger_t         **logger,
644 644
 	 */
645 645
 	*logger = LOGGER(n);
646 646
 	return ret_ok;
  647
+
  648
+error:
  649
+	cherokee_logger_free (LOGGER(n));
  650
+	return ret_error;
647 651
 }
648 652
 
649 653
 ret_t

0 notes on commit 2e1e693

Please sign in to comment.
Something went wrong with that request. Please try again.