From 9f559aa7068b38ba510640873a58953e94139248 Mon Sep 17 00:00:00 2001 From: kraai Date: Wed, 13 Sep 2000 02:46:14 +0000 Subject: Fix calls to {m,c,re}alloc so that they use x{m,c,re}alloc instead of segfaulting or handling errors the same way themselves. git-svn-id: svn://busybox.net/trunk/busybox@1039 69ca8d6d-28ef-0310-b511-8ec308f3f277 --- sed.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'sed.c') diff --git a/sed.c b/sed.c index f3c3262e4..0e0d7f58c 100644 --- a/sed.c +++ b/sed.c @@ -44,7 +44,6 @@ */ #include -#include /* for realloc() */ #include /* for getopt() */ #include #include /* for strdup() */ @@ -457,7 +456,7 @@ static void add_cmd_str(const char *cmdstr) continue; } /* grow the array */ - sed_cmds = realloc(sed_cmds, sizeof(struct sed_cmd) * (++ncmds)); + sed_cmds = xrealloc(sed_cmds, sizeof(struct sed_cmd) * (++ncmds)); /* zero new element */ memset(&sed_cmds[ncmds-1], 0, sizeof(struct sed_cmd)); /* load command string into new array element, get remainder */ @@ -481,7 +480,7 @@ static void load_cmd_file(char *filename) /* if a line ends with '\' it needs the next line appended to it */ while (line[strlen(line)-2] == '\\' && (nextline = get_line_from_file(cmdfile)) != NULL) { - line = realloc(line, strlen(line) + strlen(nextline) + 1); + line = xrealloc(line, strlen(line) + strlen(nextline) + 1); strcat(line, nextline); free(nextline); } -- cgit v1.2.3-55-g6feb