summaryrefslogtreecommitdiffstats
path: root/lib/libstand/zipfs.c
diff options
context:
space:
mode:
authorkris <kris@FreeBSD.org>2001-09-03 05:57:06 +0000
committerkris <kris@FreeBSD.org>2001-09-03 05:57:06 +0000
commitbc52b0fc5684c6efef7d3764778899947e8a01c0 (patch)
tree4654b31797c5a39ece36dec54a4b3505b8a0f37a /lib/libstand/zipfs.c
parentf85b78dcf9f1331165f74ad0122f248ce3e8d17c (diff)
downloadFreeBSD-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/zipfs.c')
-rw-r--r--lib/libstand/zipfs.c4
1 files changed, 4 insertions, 0 deletions
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;
OpenPOWER on IntegriCloud