summaryrefslogtreecommitdiffstats
path: root/usr.bin/at/at.c
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2001-07-24 14:15:51 +0000
committerobrien <obrien@FreeBSD.org>2001-07-24 14:15:51 +0000
commitee6fd791db08e5c6c71916978b0b7a7434725f7d (patch)
tree231183bf6a2a2e31e819307d46beff2a2319d6d7 /usr.bin/at/at.c
parent6a671f268436112bbf62eda34eaddc7b6ac68b90 (diff)
downloadFreeBSD-src-ee6fd791db08e5c6c71916978b0b7a7434725f7d.zip
FreeBSD-src-ee6fd791db08e5c6c71916978b0b7a7434725f7d.tar.gz
Expland `mymalloc' with malloc + error checking.
Diffstat (limited to 'usr.bin/at/at.c')
-rw-r--r--usr.bin/at/at.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/usr.bin/at/at.c b/usr.bin/at/at.c
index 909207a..cad2e49 100644
--- a/usr.bin/at/at.c
+++ b/usr.bin/at/at.c
@@ -156,7 +156,8 @@ static char *cwdname(void)
static size_t size = SIZE;
if (ptr == NULL)
- ptr = (char *) mymalloc(size);
+ if ((ptr = malloc(size)) == NULL)
+ errx(EXIT_FAILURE, "virtual memory exhausted");
while (1)
{
@@ -171,7 +172,8 @@ static char *cwdname(void)
free (ptr);
size += SIZE;
- ptr = (char *) mymalloc(size);
+ if ((ptr = malloc(size)) == NULL)
+ errx(EXIT_FAILURE, "virtual memory exhausted");
}
}
@@ -586,17 +588,6 @@ process_jobs(int argc, char **argv, int what)
}
} /* delete_jobs */
-/* Global functions */
-
-void *
-mymalloc(size_t n)
-{
- void *p;
- if ((p=malloc(n))==(void *)0)
- errx(EXIT_FAILURE, "virtual memory exhausted");
- return p;
-}
-
int
main(int argc, char **argv)
{
OpenPOWER on IntegriCloud