diff options
-rw-r--r-- | kerberosIV/roken/getarg.c | 12 |
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++; } |