mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-14 10:09:48 +00:00
Check for malloc failure in a couple of cases
MFC after: 2 weeks
This commit is contained in:
parent
1012cb601c
commit
af42d47866
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=82852
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user