diff options
author | kris <kris@FreeBSD.org> | 2001-09-03 05:57:06 +0000 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2001-09-03 05:57:06 +0000 |
commit | bc52b0fc5684c6efef7d3764778899947e8a01c0 (patch) | |
tree | 4654b31797c5a39ece36dec54a4b3505b8a0f37a /lib/libstand | |
parent | f85b78dcf9f1331165f74ad0122f248ce3e8d17c (diff) | |
download | FreeBSD-src-bc52b0fc5684c6efef7d3764778899947e8a01c0.zip FreeBSD-src-bc52b0fc5684c6efef7d3764778899947e8a01c0.tar.gz |
Check for malloc failure in a couple of cases
MFC after: 2 weeks
Diffstat (limited to 'lib/libstand')
-rw-r--r-- | lib/libstand/gzipfs.c | 4 | ||||
-rw-r--r-- | lib/libstand/zipfs.c | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/libstand/gzipfs.c b/lib/libstand/gzipfs.c index bcf0ace..61e7215 100644 --- a/lib/libstand/gzipfs.c +++ b/lib/libstand/gzipfs.c @@ -179,6 +179,8 @@ zf_open(const char *fname, struct open_file *f) /* Construct new name */ zfname = malloc(strlen(fname) + 4); + if (zfname == NULL) + return(ENOMEM); sprintf(zfname, "%s.gz", fname); /* Try to open the compressed datafile */ @@ -200,6 +202,8 @@ zf_open(const char *fname, struct open_file *f) /* Allocate a z_file structure, populate it */ zf = malloc(sizeof(struct z_file)); + if (zf == NULL) + return(ENOMEM); bzero(zf, sizeof(struct z_file)); zf->zf_rawfd = rawfd; diff --git a/lib/libstand/zipfs.c b/lib/libstand/zipfs.c index bcf0ace..61e7215 100644 --- a/lib/libstand/zipfs.c +++ b/lib/libstand/zipfs.c @@ -179,6 +179,8 @@ zf_open(const char *fname, struct open_file *f) /* Construct new name */ zfname = malloc(strlen(fname) + 4); + if (zfname == NULL) + return(ENOMEM); sprintf(zfname, "%s.gz", fname); /* Try to open the compressed datafile */ @@ -200,6 +202,8 @@ zf_open(const char *fname, struct open_file *f) /* Allocate a z_file structure, populate it */ zf = malloc(sizeof(struct z_file)); + if (zf == NULL) + return(ENOMEM); bzero(zf, sizeof(struct z_file)); zf->zf_rawfd = rawfd; |