summaryrefslogtreecommitdiff
path: root/kerberosIV/kadmin/sl.c
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>1998-08-16 02:42:12 +0000
committerArtur Grabowski <art@cvs.openbsd.org>1998-08-16 02:42:12 +0000
commit364a0613877e4712a7614d08e62ec043adfbf94b (patch)
tree6d958783b2dd21a5d023a0db66ec592659ae63ad /kerberosIV/kadmin/sl.c
parent7f6450fdf2329ea9c097d81109b3f08742bf8a4d (diff)
realloc fixes
Diffstat (limited to 'kerberosIV/kadmin/sl.c')
-rw-r--r--kerberosIV/kadmin/sl.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/kerberosIV/kadmin/sl.c b/kerberosIV/kadmin/sl.c
index 6b75e98ab50..5ec5500406a 100644
--- a/kerberosIV/kadmin/sl.c
+++ b/kerberosIV/kadmin/sl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sl.c,v 1.2 1998/02/18 11:53:46 art Exp $ */
+/* $OpenBSD: sl.c,v 1.3 1998/08/16 02:42:07 art Exp $ */
/* $KTH: sl.c,v 1.15 1997/10/19 23:12:40 assar Exp $ */
/*
@@ -168,14 +168,19 @@ sl_loop (SL_cmd *cmds, char *prompt)
p;
p = strtok_r (NULL, " \t", &foo)) {
if(count == max_count) {
+ char **temp;
+
max_count *= 2;
- ptr = realloc (ptr, max_count * sizeof(*ptr));
- if (ptr == NULL) {
+ temp = realloc (ptr, max_count * sizeof(*ptr));
+ if (temp == NULL) {
printf ("sl_loop: failed to allocate %u "
"bytes of memory\n",
(unsigned) max_count * sizeof(*ptr));
+
+ free(ptr);
return -1;
}
+ ptr = temp;
}
ptr[count++] = p;
}