diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-09-24 20:40:20 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-09-24 20:40:20 +0000 |
commit | 76babf87a3062e78fa213f8870a403b3da878020 (patch) | |
tree | 5a9e5e5c1c3cf4e28d259f8aa172987941098131 /sbin/disklabel/editor.c | |
parent | 3ee08ce607314cf704bf3875b67bc414b72a0464 (diff) |
realloc fixes; ok ho
Diffstat (limited to 'sbin/disklabel/editor.c')
-rw-r--r-- | sbin/disklabel/editor.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c index 9503a821a4c..2e2ed1e975b 100644 --- a/sbin/disklabel/editor.c +++ b/sbin/disklabel/editor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: editor.c,v 1.90 2003/08/29 00:17:09 tedu Exp $ */ +/* $OpenBSD: editor.c,v 1.91 2003/09/24 20:40:19 deraadt Exp $ */ /* * Copyright (c) 1997-2000 Todd C. Miller <Todd.Miller@courtesan.com> @@ -17,7 +17,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: editor.c,v 1.90 2003/08/29 00:17:09 tedu Exp $"; +static char rcsid[] = "$OpenBSD: editor.c,v 1.91 2003/09/24 20:40:19 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -1887,14 +1887,16 @@ char ** mpcopy(char **to, char **from) { int i; + char *top; for (i = 0; i < MAXPARTITIONS; i++) { if (from[i] != NULL) { int len = strlen(from[i]) + 1; - to[i] = realloc(to[i], len); - if (to[i] == NULL) + top = realloc(to[i], len); + if (top == NULL) errx(4, "out of memory"); + to[i] = top; (void)strlcpy(to[i], from[i], len); } else if (to[i] != NULL) { free(to[i]); |