diff options
author | kraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-11-12 16:58:07 +0000 |
---|---|---|
committer | kraai <kraai@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-11-12 16:58:07 +0000 |
commit | 7ae9e6337e17044ef7593f2f90ab5f33c9689c46 (patch) | |
tree | 4ea36d7601808197ee6cb238ed0edd63e1da079e | |
parent | bc8366289da20a7fa72dffac54a1074cb38c8055 (diff) | |
download | busybox-w32-7ae9e6337e17044ef7593f2f90ab5f33c9689c46.tar.gz busybox-w32-7ae9e6337e17044ef7593f2f90ab5f33c9689c46.tar.bz2 busybox-w32-7ae9e6337e17044ef7593f2f90ab5f33c9689c46.zip |
Convert strdup call to xstrdup, and calloc calls to xcalloc (patch from
Steve Merrifield).
git-svn-id: svn://busybox.net/trunk/busybox@3667 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r-- | findutils/grep.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/findutils/grep.c b/findutils/grep.c index faecb58bc..48329e135 100644 --- a/findutils/grep.c +++ b/findutils/grep.c | |||
@@ -155,7 +155,7 @@ static void grep_file(FILE *file) | |||
155 | if(lines_before) { | 155 | if(lines_before) { |
156 | if(before_buf[curpos]) | 156 | if(before_buf[curpos]) |
157 | free(before_buf[curpos]); | 157 | free(before_buf[curpos]); |
158 | before_buf[curpos] = strdup(line); | 158 | before_buf[curpos] = xstrdup(line); |
159 | curpos = (curpos + 1) % lines_before; | 159 | curpos = (curpos + 1) % lines_before; |
160 | } | 160 | } |
161 | } | 161 | } |
@@ -306,13 +306,13 @@ extern int grep_main(int argc, char **argv) | |||
306 | lines_before = strtoul(optarg, &junk, 10); | 306 | lines_before = strtoul(optarg, &junk, 10); |
307 | if(*junk != '\0') | 307 | if(*junk != '\0') |
308 | error_msg_and_die("invalid context length argument"); | 308 | error_msg_and_die("invalid context length argument"); |
309 | before_buf = (char **)calloc(lines_before, sizeof(char *)); | 309 | before_buf = (char **)xcalloc(lines_before, sizeof(char *)); |
310 | break; | 310 | break; |
311 | case 'C': | 311 | case 'C': |
312 | lines_after = lines_before = strtoul(optarg, &junk, 10); | 312 | lines_after = lines_before = strtoul(optarg, &junk, 10); |
313 | if(*junk != '\0') | 313 | if(*junk != '\0') |
314 | error_msg_and_die("invalid context length argument"); | 314 | error_msg_and_die("invalid context length argument"); |
315 | before_buf = (char **)calloc(lines_before, sizeof(char *)); | 315 | before_buf = (char **)xcalloc(lines_before, sizeof(char *)); |
316 | break; | 316 | break; |
317 | #endif /* CONFIG_FEATURE_GREP_CONTEXT */ | 317 | #endif /* CONFIG_FEATURE_GREP_CONTEXT */ |
318 | default: | 318 | default: |