diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2018-07-08 17:15:08 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2018-07-08 17:15:08 +0000 |
commit | d464459430dfe32556dda698f3f70370957dd913 (patch) | |
tree | 033b62bab4275329edca02f08ec39149953e3763 /sbin | |
parent | fc6ca168ed4b376c9c7f2c398d10ff6c1497be54 (diff) |
Be consistent in warn() and log_warn() usage when
running out of memory.
Next step, be correct *and* consistent.
ok dennis@ tb@ benno@ schwarze@
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/iked/parse.y | 6 | ||||
-rw-r--r-- | sbin/ipsecctl/parse.y | 6 | ||||
-rw-r--r-- | sbin/pfctl/parse.y | 8 |
3 files changed, 11 insertions, 9 deletions
diff --git a/sbin/iked/parse.y b/sbin/iked/parse.y index 8a817d163b7..25c08cd766b 100644 --- a/sbin/iked/parse.y +++ b/sbin/iked/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.72 2018/06/11 10:05:17 denis Exp $ */ +/* $OpenBSD: parse.y,v 1.73 2018/07/08 17:15:07 krw Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org> @@ -1503,11 +1503,11 @@ pushfile(const char *name, int secret) struct file *nfile; if ((nfile = calloc(1, sizeof(struct file))) == NULL) { - warn("malloc"); + warn("calloc"); return (NULL); } if ((nfile->name = strdup(name)) == NULL) { - warn("malloc"); + warn("strdup"); free(nfile); return (NULL); } diff --git a/sbin/ipsecctl/parse.y b/sbin/ipsecctl/parse.y index d9739724d32..e022bf55dd7 100644 --- a/sbin/ipsecctl/parse.y +++ b/sbin/ipsecctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.170 2018/04/26 14:12:19 krw Exp $ */ +/* $OpenBSD: parse.y,v 1.171 2018/07/08 17:15:07 krw Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -1300,11 +1300,11 @@ pushfile(const char *name, int secret) struct file *nfile; if ((nfile = calloc(1, sizeof(struct file))) == NULL) { - warn("malloc"); + warn("calloc"); return (NULL); } if ((nfile->name = strdup(name)) == NULL) { - warn("malloc"); + warn("strdup"); free(nfile); return (NULL); } diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 3ce2fda94c1..98e4854dbfe 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.673 2018/05/18 13:39:49 benno Exp $ */ +/* $OpenBSD: parse.y,v 1.674 2018/07/08 17:15:07 krw Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. @@ -5549,9 +5549,11 @@ pushfile(const char *name, int secret) if ((nfile = calloc(1, sizeof(struct file))) == NULL || (nfile->name = strdup(name)) == NULL) { - if (nfile) + if (nfile) { + warn("strdup"); free(nfile); - warn("malloc"); + } else + warn("calloc"); return (NULL); } if (TAILQ_FIRST(&files) == NULL && strcmp(nfile->name, "-") == 0) { |