From 9d1587b49e4692b8d6652e6c0b113a53b1af5313 Mon Sep 17 00:00:00 2001 From: John Levon Date: Wed, 19 Dec 2018 18:17:15 +0000 Subject: [PATCH] =?UTF-8?q?10124=20smatch=20fixes=20for=20cryptoadm=20Revi?= =?UTF-8?q?ewed=20by:=20Andy=20Stormont=20?= =?UTF-8?q?=20Reviewed=20by:=20Gerg=C5=91=20Doma=20=20A?= =?UTF-8?q?pproved=20by:=20Robert=20Mustacchi=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- usr/src/cmd/cmd-crypto/cryptoadm/adm_kef_ioctl.c | 2 ++ usr/src/cmd/cmd-crypto/cryptoadm/adm_uef.c | 3 ++- usr/src/cmd/cmd-crypto/cryptoadm/cryptoadm.c | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/usr/src/cmd/cmd-crypto/cryptoadm/adm_kef_ioctl.c b/usr/src/cmd/cmd-crypto/cryptoadm/adm_kef_ioctl.c index a65316abbc9e..ed1b2849900d 100644 --- a/usr/src/cmd/cmd-crypto/cryptoadm/adm_kef_ioctl.c +++ b/usr/src/cmd/cmd-crypto/cryptoadm/adm_kef_ioctl.c @@ -23,6 +23,7 @@ */ /* * Copyright 2010 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2018, Joyent, Inc. */ #include @@ -266,6 +267,7 @@ get_dev_list(crypto_get_dev_list_t **ppdevlist) if ((fd = open(ADMIN_IOCTL_DEVICE, O_RDONLY)) == -1) { cryptoerror(LOG_STDERR, gettext("failed to open %s: %s"), ADMIN_IOCTL_DEVICE, strerror(errno)); + free(pdevlist); return (FAILURE); } diff --git a/usr/src/cmd/cmd-crypto/cryptoadm/adm_uef.c b/usr/src/cmd/cmd-crypto/cryptoadm/adm_uef.c index 47d0ab51f02e..873642d190a9 100644 --- a/usr/src/cmd/cmd-crypto/cryptoadm/adm_uef.c +++ b/usr/src/cmd/cmd-crypto/cryptoadm/adm_uef.c @@ -23,6 +23,7 @@ */ /* * Copyright 2010 Nexenta Systems, Inc. All rights resrved. + * Copyright (c) 2018, Joyent, Inc. */ #include @@ -161,7 +162,7 @@ convert_mechlist(CK_MECHANISM_TYPE **pmech_list, CK_ULONG *mech_count, } *pmech_list = malloc(n * sizeof (CK_MECHANISM_TYPE)); - if (pmech_list == NULL) { + if (*pmech_list == NULL) { cryptodebug("out of memory"); return (FAILURE); } diff --git a/usr/src/cmd/cmd-crypto/cryptoadm/cryptoadm.c b/usr/src/cmd/cmd-crypto/cryptoadm/cryptoadm.c index 989eae315a97..f4d5e17b1793 100644 --- a/usr/src/cmd/cmd-crypto/cryptoadm/cryptoadm.c +++ b/usr/src/cmd/cmd-crypto/cryptoadm/cryptoadm.c @@ -22,6 +22,9 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. */ +/* + * Copyright (c) 2018, Joyent, Inc. + */ #include #include @@ -1302,7 +1305,6 @@ list_simple_for_all(boolean_t verbose) "failed to retrieve the providers' " "information from file kcf.conf - %s.", _PATH_KCF_CONF); - free(psoftlist_kernel); rc = FAILURE; } else {