Small memleak in locallogger.
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Fri, 15 Feb 2013 09:48:08 +0000 (09:48 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Fri, 15 Feb 2013 21:59:14 +0000 (22:59 +0100)
org.glite.lb.logger/src/logd_proto.c

index f8b80b7..cc33497 100644 (file)
@@ -319,18 +319,20 @@ int wait_for_confirmation(struct timeval *timeout, int *code)
 int do_listen(int port)
 {
        int                ret;
-       int                sock;
+       int                sock = -1;
        char            *portstr = NULL;
 
        asprintf(&portstr, "%d", port);
        if (portstr == NULL) {
                glite_common_log(LOG_CATEGORY_CONTROL,LOG_PRIORITY_FATAL,"do_listen(): ENOMEM converting port number\n");
-               return -1;
+               goto err;
        }
 
        if (daemon_listen(NULL, portstr, &sock) != 0)
-               return -1;
+               goto err;
 
+err:
+       free(portstr);
        return sock;
 }