summaryrefslogtreecommitdiff
path: root/kerberosIV
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>1998-08-16 20:54:50 +0000
committerArtur Grabowski <art@cvs.openbsd.org>1998-08-16 20:54:50 +0000
commit976c506be0a96c2303d0f33a3a62aabcf564690c (patch)
tree0c12fad8457172d5404f6f0b9d2f089944da9864 /kerberosIV
parenta7461f865d648909ea4d538af010b582d0218271 (diff)
realloc misuse
Diffstat (limited to 'kerberosIV')
-rw-r--r--kerberosIV/roken/getarg.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/kerberosIV/roken/getarg.c b/kerberosIV/roken/getarg.c
index 1ca11986444..d5081e5aa0e 100644
--- a/kerberosIV/roken/getarg.c
+++ b/kerberosIV/roken/getarg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getarg.c,v 1.2 1998/08/12 23:39:38 art Exp $ */
+/* $OpenBSD: getarg.c,v 1.3 1998/08/16 20:54:49 art Exp $ */
/* $KTH: getarg.c,v 1.18 1998/01/22 20:23:16 joda Exp $ */
/*
* Copyright (c) 1997, 1998 Kungliga Tekniska Högskolan
@@ -322,7 +322,15 @@ arg_printusage (struct getargs *args,
static void
add_string(getarg_strings *s, char *value)
{
- s->strings = realloc(s->strings, (s->num_strings + 1) * sizeof(*s->strings));
+ char **temp;
+
+ temp = realloc(s->strings, (s->num_strings + 1) * sizeof(*s->strings));
+ if (temp == NULL){
+ free (s->strings);
+ err(1, "realloc:");
+ }
+ s->strings = temp;
+
s->strings[s->num_strings] = value;
s->num_strings++;
}