aboutsummaryrefslogtreecommitdiff
path: root/sed.c
diff options
context:
space:
mode:
Diffstat (limited to 'sed.c')
-rw-r--r--sed.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sed.c b/sed.c
index f3c3262e4..0e0d7f58c 100644
--- a/sed.c
+++ b/sed.c
@@ -44,7 +44,6 @@
44*/ 44*/
45 45
46#include <stdio.h> 46#include <stdio.h>
47#include <stdlib.h> /* for realloc() */
48#include <unistd.h> /* for getopt() */ 47#include <unistd.h> /* for getopt() */
49#include <regex.h> 48#include <regex.h>
50#include <string.h> /* for strdup() */ 49#include <string.h> /* for strdup() */
@@ -457,7 +456,7 @@ static void add_cmd_str(const char *cmdstr)
457 continue; 456 continue;
458 } 457 }
459 /* grow the array */ 458 /* grow the array */
460 sed_cmds = realloc(sed_cmds, sizeof(struct sed_cmd) * (++ncmds)); 459 sed_cmds = xrealloc(sed_cmds, sizeof(struct sed_cmd) * (++ncmds));
461 /* zero new element */ 460 /* zero new element */
462 memset(&sed_cmds[ncmds-1], 0, sizeof(struct sed_cmd)); 461 memset(&sed_cmds[ncmds-1], 0, sizeof(struct sed_cmd));
463 /* load command string into new array element, get remainder */ 462 /* load command string into new array element, get remainder */
@@ -481,7 +480,7 @@ static void load_cmd_file(char *filename)
481 /* if a line ends with '\' it needs the next line appended to it */ 480 /* if a line ends with '\' it needs the next line appended to it */
482 while (line[strlen(line)-2] == '\\' && 481 while (line[strlen(line)-2] == '\\' &&
483 (nextline = get_line_from_file(cmdfile)) != NULL) { 482 (nextline = get_line_from_file(cmdfile)) != NULL) {
484 line = realloc(line, strlen(line) + strlen(nextline) + 1); 483 line = xrealloc(line, strlen(line) + strlen(nextline) + 1);
485 strcat(line, nextline); 484 strcat(line, nextline);
486 free(nextline); 485 free(nextline);
487 } 486 }