]> xenbits.xensource.com Git - libvirt.git/commitdiff
phyp_driver: Resolve Coverity RESOURCE_LEAK
authorJohn Ferlan <jferlan@redhat.com>
Wed, 27 Aug 2014 19:31:38 +0000 (15:31 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 28 Aug 2014 12:12:17 +0000 (08:12 -0400)
Coverity determines that when jumping to the connected: label, the
addressinfo (ai) is not free'd.

src/phyp/phyp_driver.c

index aa1e1053efbca9276384c49106b884f14716c16c..ea1981a38280b86347c3645967ade06765084d5d 100644 (file)
@@ -946,6 +946,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
         sock = socket(cur->ai_family, cur->ai_socktype, cur->ai_protocol);
         if (sock >= 0) {
             if (connect(sock, cur->ai_addr, cur->ai_addrlen) == 0) {
+                freeaddrinfo(ai);
                 goto connected;
             }
             VIR_FORCE_CLOSE(sock);