[Opendnssec-commits] [keihatsu.kirei.se/svn/dnssec] r4126 - trunk/OpenDNSSEC/signer/src/signer

Matthijs Mekking matthijs at nlnetlabs.nl
Mon Oct 18 12:57:46 CEST 2010


Author: matthijs
Date: 2010-10-18 12:57:46 +0200 (Mon, 18 Oct 2010)
New Revision: 4126

Modified:
   trunk/OpenDNSSEC/signer/src/signer/nsec3params.c
   trunk/OpenDNSSEC/signer/src/signer/signconf.c
   trunk/OpenDNSSEC/signer/src/signer/zone.c
   trunk/OpenDNSSEC/signer/src/signer/zonedata.c
Log:
some more leak fixing



Modified: trunk/OpenDNSSEC/signer/src/signer/nsec3params.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/nsec3params.c	2010-10-18 10:28:56 UTC (rev 4125)
+++ trunk/OpenDNSSEC/signer/src/signer/nsec3params.c	2010-10-18 10:57:46 UTC (rev 4126)
@@ -144,6 +144,10 @@
             ldns_rr_free(nsec3params_rr);
             nsec3params_rr = NULL;
         }
+        if (salt) {
+            se_free((void*) salt);
+            salt = NULL;
+        }
         return NULL;
     }
 
@@ -154,6 +158,8 @@
     /* construct the salt from the string */
     if (nsec3params_create_salt(salt, &salt_len, &salt_data) != 0) {
         se_free((void*)nsec3params);
+        se_free((void*)salt);
+        ldns_rr_free(nsec3params_rr);
         return NULL;
     }
     nsec3params->salt_len = salt_len; /* salt length */

Modified: trunk/OpenDNSSEC/signer/src/signer/signconf.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/signconf.c	2010-10-18 10:28:56 UTC (rev 4125)
+++ trunk/OpenDNSSEC/signer/src/signer/signconf.c	2010-10-18 10:57:46 UTC (rev 4126)
@@ -146,6 +146,7 @@
 signconf_recover_from_backup(const char* filename)
 {
     signconf_type* signconf = NULL;
+    const char* zonename = NULL;
     FILE* scfd = NULL;
 
     scfd = se_fopen(filename, NULL, "r");
@@ -154,7 +155,7 @@
 
         if (!backup_read_check_str(scfd, ODS_SE_FILE_MAGIC) ||
             !backup_read_check_str(scfd, ";name:") ||
-            !backup_read_str(scfd, &signconf->name) ||
+            !backup_read_str(scfd, &zonename) ||
             !backup_read_check_str(scfd, ";filename:") ||
             !backup_read_str(scfd, &signconf->filename) ||
             !backup_read_check_str(scfd, ";last_modified:") ||
@@ -190,6 +191,10 @@
             signconf_cleanup(signconf);
             signconf = NULL;
         }
+
+        if (zonename) {
+            se_free((void*) zonename);
+        }
         se_fclose(scfd);
         return signconf;
     }

Modified: trunk/OpenDNSSEC/signer/src/signer/zone.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/zone.c	2010-10-18 10:28:56 UTC (rev 4125)
+++ trunk/OpenDNSSEC/signer/src/signer/zone.c	2010-10-18 10:57:46 UTC (rev 4126)
@@ -779,11 +779,14 @@
                 }
                 rr = NULL;
             } else if (se_strcmp(token, ODS_SE_FILE_MAGIC) == 0) {
+                se_free((void*) token);
+                token = NULL;
                 break;
             } else {
                 corrupted = 1;
             }
             se_free((void*) token);
+            token = NULL;
         } else {
             corrupted = 1;
         }
@@ -812,7 +815,6 @@
 
     while (!corrupted) {
         if (backup_read_str(fd, &token)) {
-
             if (se_strcmp(token, ";RRSIG") == 0) {
                 if (!backup_read_str(fd, &locator) ||
                     !backup_read_uint32_t(fd, &flags)) {
@@ -833,10 +835,14 @@
                     }
                 }
             } else if (se_strcmp(token, ODS_SE_FILE_MAGIC) == 0) {
+                se_free((void*) token);
+                token = NULL;
                 break;
             } else {
                 corrupted = 1;
             }
+            se_free((void*) token);
+            token = NULL;
         } else {
             corrupted = 1;
         }
@@ -909,6 +915,7 @@
         /* no, stop recovering process */
         return;
     }
+    zone->signconf->name = zone->name;
     zone->signconf->keys = keylist_create();
 
     /* recover denial of existence */

Modified: trunk/OpenDNSSEC/signer/src/signer/zonedata.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/zonedata.c	2010-10-18 10:28:56 UTC (rev 4125)
+++ trunk/OpenDNSSEC/signer/src/signer/zonedata.c	2010-10-18 10:57:46 UTC (rev 4126)
@@ -201,10 +201,14 @@
                 rr = NULL;
                 status = LDNS_STATUS_OK;
             } else if (se_strcmp(token, ODS_SE_FILE_MAGIC) == 0) {
+                se_free((void*)token);
+                token = NULL;
                 break;
             } else {
                 corrupted = 1;
             }
+            se_free((void*)token);
+            token = NULL;
         } else {
             corrupted = 1;
         }




More information about the Opendnssec-commits mailing list