diff options
| author | 2003-09-24 20:40:19 +0000 | |
|---|---|---|
| committer | 2003-09-24 20:40:19 +0000 | |
| commit | 0612d09dd7dd26ed133a9d398014b894617d3e6c (patch) | |
| tree | 2b82a8921b4294752f9ac73bf06722a21fdbebdc /sbin/disklabel/editor.c | |
| parent | realloc fixes; ok ho matthieu (diff) | |
| download | wireguard-openbsd-0612d09dd7dd26ed133a9d398014b894617d3e6c.tar.xz wireguard-openbsd-0612d09dd7dd26ed133a9d398014b894617d3e6c.zip | |
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]); |
