Browse Source

No need to mention which memory allocation entry point failed (malloc,

calloc or strdup), we just need to log that we ran out of memory in a
particular function.
Recommended by florian@ and deraadt@
ok benno@ henning@ tb@
OPENBSD_6_4
krw 6 years ago
parent
commit
b977896d36
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      src/usr.sbin/ntpd/parse.y

+ 4
- 4
src/usr.sbin/ntpd/parse.y View File

@ -1,4 +1,4 @@
/* $OpenBSD: parse.y,v 1.68 2018/07/08 17:15:07 krw Exp $ */
/* $OpenBSD: parse.y,v 1.69 2018/07/09 12:05:11 krw Exp $ */
/* /*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -733,16 +733,16 @@ pushfile(const char *name)
struct file *nfile; struct file *nfile;
if ((nfile = calloc(1, sizeof(struct file))) == NULL) { if ((nfile = calloc(1, sizeof(struct file))) == NULL) {
log_warn("calloc");
log_warn("%s", __func__);
return (NULL); return (NULL);
} }
if ((nfile->name = strdup(name)) == NULL) { if ((nfile->name = strdup(name)) == NULL) {
log_warn("strdup");
log_warn("%s", __func__);
free(nfile); free(nfile);
return (NULL); return (NULL);
} }
if ((nfile->stream = fopen(nfile->name, "r")) == NULL) { if ((nfile->stream = fopen(nfile->name, "r")) == NULL) {
log_warn("%s", nfile->name);
log_warn("%s: %s", __func__, nfile->name);
free(nfile->name); free(nfile->name);
free(nfile); free(nfile);
return (NULL); return (NULL);


Loading…
Cancel
Save