OSSP CVS Repository

ossp - Check-in [3182]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 3182
Date: 2003-Feb-09 15:43:28 (local)
2003-Feb-09 14:43:28 (UTC)
User:rse
Branch:
Comment: Fix memory leak in test suite (sa_test.c). (detected by valgrind, see ¤http://developer.kde.org/~sewardj/)
Tickets:
Inspections:
Files:
ossp-pkg/sa/ChangeLog      1.24 -> 1.25     3 inserted, 0 deleted
ossp-pkg/sa/sa_test.c      1.25 -> 1.26     4 inserted, 1 deleted

ossp-pkg/sa/ChangeLog 1.24 -> 1.25

--- ChangeLog    2003/02/07 20:47:51     1.24
+++ ChangeLog    2003/02/09 14:43:28     1.25
@@ -13,6 +13,9 @@
 
   Changes between 1.0.5 and 1.1.0 (31-Jan-2003 to xx-Feb-2003)
 
+   o Fix memory leak in test suite (sa_test.c).
+     [Ralf S. Engelschall <rse@engelschall.com>]
+
    o Added internal address resolving support via the new IEEE Std
      1003.1g-2000 ("POSIX.1") getaddrinfo(3) API. This especially
      provides more portable IPv6 address resolving.


ossp-pkg/sa/sa_test.c 1.25 -> 1.26

--- sa_test.c    2003/02/07 20:47:51     1.25
+++ sa_test.c    2003/02/09 14:43:28     1.26
@@ -81,9 +81,11 @@
             ts_test_fail(TS_CTX, "sa_addr_a2u -> %d[%s] (expected %d[%s])",
                          rv, sa_error(rv), table[i].rv, sa_error(table[i].rv));
         ts_test_check(TS_CTX, "sa_addr_a2u");
-        if ((rv = sa_addr_a2u(saa, &cp)) != SA_OK)
+        if ((rv = sa_addr_a2u(saa, &cp)) != SA_OK) {
             ts_test_fail(TS_CTX, "sa_addr_u2a -> %d[%s] (expected %d[%s])",
                          rv, sa_error(rv), SA_OK, sa_error(SA_OK));
+            continue;
+        }
         if (table[i].rv == SA_OK) {
             if (table[i].out_alt != NULL) {
                 if (strcmp(cp, table[i].out) != 0 && strcmp(cp, table[i].out_alt) != 0)
@@ -96,6 +98,7 @@
                                  cp, table[i].out);
             }
         }
+        free(cp);
     }
     ts_test_check(TS_CTX, "sa_addr_destroy");
     if ((rv = sa_addr_destroy(saa)) != SA_OK)

CVSTrac 2.0.1