Module: kamailio Branch: master Commit: f6f6c7f55d5d1a60c1beb6091744116a6b85b397 URL: https://github.com/kamailio/kamailio/commit/f6f6c7f55d5d1a60c1beb6091744116a6b85b397
Author: Daniel-Constantin Mierla <mico...@gmail.com> Committer: Daniel-Constantin Mierla <mico...@gmail.com> Date: 2016-11-02T14:01:52+01:00 statsd: free srv variable in error handling --- Modified: modules/statsd/lib_statsd.c --- Diff: https://github.com/kamailio/kamailio/commit/f6f6c7f55d5d1a60c1beb6091744116a6b85b397.diff Patch: https://github.com/kamailio/kamailio/commit/f6f6c7f55d5d1a60c1beb6091744116a6b85b397.patch --- diff --git a/modules/statsd/lib_statsd.c b/modules/statsd/lib_statsd.c index 878b452..926aa3e 100644 --- a/modules/statsd/lib_statsd.c +++ b/modules/statsd/lib_statsd.c @@ -19,7 +19,7 @@ static StatsConnection statsd_connection = { bool statsd_connect(void){ - struct addrinfo *serverAddr; + struct addrinfo *serverAddr = NULL; int rc; if (statsd_connection.sock > 0){ @@ -34,12 +34,14 @@ bool statsd_connect(void){ LM_ERR( "Statsd: could not initiate server information (%s)\n", gai_strerror(rc)); + if(serverAddr) freeaddrinfo(serverAddr); return false; } statsd_connection.sock = socket(serverAddr->ai_family, SOCK_DGRAM, IPPROTO_UDP); if (statsd_connection.sock < 0 ){ LM_ERR("Statsd: could not create a socket for statsd connection\n"); + if(serverAddr) freeaddrinfo(serverAddr); return false; } _______________________________________________ sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev