[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Re: memory corruption in new MEMORY keytab




Andrew Bartlett <abartlet@samba.org> writes:

> Presuming the realloc failed (not possible in this case, as it is a
> realloc for a smaller size), it would return NULL, but you would still
> want to free the original pointer.
>
> In sort, yes.

How about this then ?

Love

--- lib/krb5/keytab_memory.c	01 Dec 2005 13:40:22 +0100	1.7
+++ lib/krb5/keytab_memory.c	05 Dec 2005 19:34:15 +0100	
@@ -215,7 +215,7 @@
 	return KRB5_KT_NOTFOUND;
     }
     e = realloc(d->entries, d->num_entries * sizeof(*d->entries));
-    if(e != NULL)
+    if(e != NULL || d->num_entries == 0)
 	d->entries = e;
     return 0;
 }

PGP signature