svn commit: lorikeet r504 - in trunk/heimdal/lib/krb5: .

abartlet at samba.org abartlet at samba.org
Sat Dec 3 00:37:49 GMT 2005


Author: abartlet
Date: 2005-12-03 00:37:48 +0000 (Sat, 03 Dec 2005)
New Revision: 504

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=lorikeet&rev=504

Log:
I think this is a better fix for the realloc/free bugs.

Andrew Bartlett

Modified:
   trunk/heimdal/lib/krb5/keytab_memory.c


Changeset:
Modified: trunk/heimdal/lib/krb5/keytab_memory.c
===================================================================
--- trunk/heimdal/lib/krb5/keytab_memory.c	2005-12-03 00:32:32 UTC (rev 503)
+++ trunk/heimdal/lib/krb5/keytab_memory.c	2005-12-03 00:37:48 UTC (rev 504)
@@ -214,12 +214,15 @@
 	krb5_clear_error_string (context);
 	return KRB5_KT_NOTFOUND;
     }
-    e = realloc(d->entries, d->num_entries * sizeof(*d->entries));
-    if(e != NULL)
-	d->entries = e;
-    if (d->num_entries == 0) 
-	d->entries = 0;
-	    
+    if (d->num_entries == 0) {
+	free(d->entries);
+	d->entries = NULL;
+    } else {
+	e = realloc(d->entries, d->num_entries * sizeof(*d->entries));
+	if(e != NULL)
+	    d->entries = e;
+    }
+
     return 0;
 }
 



More information about the samba-cvs mailing list