diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2013-06-17 19:51:42 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2013-06-17 19:51:42 +0000 |
commit | 7b56091a830449688f4ef849a8d7413f29bc068d (patch) | |
tree | 00113bb619d33ae48fae0ebf6faa3256e6a432d9 | |
parent | af0fc5610af1cffbec26c32357c72999e9850a4e (diff) |
Check calloc() return value. Plug leak of resulting memory.
Latter from dhill.
-rw-r--r-- | sbin/dhclient/dhclient.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index fb3b3cd0122..88494a420c0 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.254 2013/06/09 22:39:51 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.255 2013/06/17 19:51:41 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -2222,10 +2222,13 @@ write_file(char *path, int flags, mode_t mode, uid_t uid, gid_t gid, size_t rslt; imsg = calloc(1, sizeof(*imsg) + sz); + if (imsg == NULL) + error("no memory for imsg_write_file"); imsg->rdomain = ifi->rdomain; rslt = strlcpy(imsg->path, path, MAXPATHLEN); if (rslt >= MAXPATHLEN) { + free(imsg); warning("write_file: path too long (%zu)", rslt); return; } |