hold_space_size = strlen(hold_space);
}
hold_space = xrealloc(hold_space, hold_space_size + strlen(pattern_space) + 2);
- strcat(hold_space, "\n");
+ if (hold_space_size) {
+ strcat(hold_space, "\n");
+ } else {
+ hold_space[0] = '\n';
+ }
strcat(hold_space, pattern_space);
break;
}
if (deleted)
break;
+
}
/* we will print the line unless we were told to be quiet or if the
else {
char *str_cmd = strdup(argv[optind]);
- add_cmd_str(strdup(str_cmd));
+ add_cmd_str(strd_cmd);
free(str_cmd);
optind++;
}