* gpgkeys_ldap.c (search_key, main): Make sure LDAP values are freed in
authorDavid Shaw <dshaw@jabberwocky.com>
Wed, 9 Oct 2002 02:25:43 +0000 (02:25 +0000)
committerDavid Shaw <dshaw@jabberwocky.com>
Wed, 9 Oct 2002 02:25:43 +0000 (02:25 +0000)
case of error.

keyserver/ChangeLog
keyserver/gpgkeys_ldap.c

index ec44ee9..565545c 100644 (file)
@@ -1,5 +1,8 @@
 2002-10-08  David Shaw  <dshaw@jabberwocky.com>
 
+       * gpgkeys_ldap.c (search_key, main): Make sure LDAP values are
+       freed in case of error.
+
        * gpgkeys_ldap.c (fail_all): New function to unwind a keylist and
        error each item.
        (main): Call fail_all from here, as needed.  Also add a NO_MEMORY
index 7772bd4..10ace54 100644 (file)
@@ -415,18 +415,20 @@ get_key(char *getkey)
                  /* YYYYMMDDHHmmssZ */
 
                  vals=ldap_get_values(ldap,each,"pgpkeycreatetime");
-                 if(vals!=NULL && strlen(vals[0])==15)
+                 if(vals!=NULL)
                    {
-                     fprintf(console,"Key created:\t%.2s/%.2s/%.4s\n",
-                             &vals[0][4],&vals[0][6],vals[0]);
+                     if(strlen(vals[0])==15)
+                       fprintf(console,"Key created:\t%.2s/%.2s/%.4s\n",
+                               &vals[0][4],&vals[0][6],vals[0]);
                      ldap_value_free(vals);
                    }
 
                  vals=ldap_get_values(ldap,each,"modifytimestamp");
-                 if(vals!=NULL && strlen(vals[0])==15)
+                 if(vals!=NULL)
                    {
-                     fprintf(console,"Key modified:\t%.2s/%.2s/%.4s\n",
-                             &vals[0][4],&vals[0][6],vals[0]);
+                     if(strlen(vals[0])==15)
+                       fprintf(console,"Key modified:\t%.2s/%.2s/%.4s\n",
+                               &vals[0][4],&vals[0][6],vals[0]);
                      ldap_value_free(vals);
                    }