From 549ab26f262a63e8892b99d530a98fea6423ad63 Mon Sep 17 00:00:00 2001 From: Matt Barden Date: Tue, 27 Sep 2022 16:56:41 -0400 Subject: 15084 SMBD leaks memory during startup/refresh Reviewed by: Andrew Stormont Reviewed by: Gordon Ross Reviewed by: Marco van Wieringen Approved by: Dan McDonald --- usr/src/lib/libshare/common/libsharecore.c | 3 +-- usr/src/lib/smbsrv/libsmb/common/smb_cfg.c | 12 ++++++------ usr/src/lib/smbsrv/libsmbns/common/smbns_ads.c | 3 +-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/usr/src/lib/libshare/common/libsharecore.c b/usr/src/lib/libshare/common/libsharecore.c index c15291d19d..9f08c0c220 100644 --- a/usr/src/lib/libshare/common/libsharecore.c +++ b/usr/src/lib/libshare/common/libsharecore.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2014 Nexenta Systems, Inc. All rights reserved. + * Copyright 2022 Tintri by DDN, Inc. All rights reserved. * Copyright (c) 2016 by Delphix. All rights reserved. */ @@ -1604,7 +1604,6 @@ parse_sharetab(sa_handle_t handle) sa_group_t lgroup; xfs_sharelist_t *list = get_share_list(&err); - list = get_share_list(&err); if (list == NULL) return (legacy); diff --git a/usr/src/lib/smbsrv/libsmb/common/smb_cfg.c b/usr/src/lib/smbsrv/libsmb/common/smb_cfg.c index 88890f4f8c..b295916cb3 100644 --- a/usr/src/lib/smbsrv/libsmb/common/smb_cfg.c +++ b/usr/src/lib/smbsrv/libsmb/common/smb_cfg.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2020 Tintri by DDN, Inc. All rights reserved. + * Copyright 2022 Tintri by DDN, Inc. All rights reserved. * Copyright 2021 RackTop Systems, Inc. */ @@ -904,6 +904,7 @@ int smb_config_get_localuuid(uuid_t uu) { char *s; + int rc = 0; uuid_clear(uu); s = smb_config_getenv_generic(MACHINE_UUID, IDMAP_FMRI_PREFIX, @@ -911,12 +912,11 @@ smb_config_get_localuuid(uuid_t uu) if (s == NULL) return (-1); - if (uuid_parse(s, uu) < 0) { - free(s); - return (-1); - } + if (uuid_parse(s, uu) < 0) + rc = -1; - return (0); + free(s); + return (rc); } static int diff --git a/usr/src/lib/smbsrv/libsmbns/common/smbns_ads.c b/usr/src/lib/smbsrv/libsmbns/common/smbns_ads.c index 0a07771985..66a187abbb 100644 --- a/usr/src/lib/smbsrv/libsmbns/common/smbns_ads.c +++ b/usr/src/lib/smbsrv/libsmbns/common/smbns_ads.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2019 Nexenta by DDN, Inc. All rights reserved. + * Copyright 2022 Tintri by DDN, Inc. All rights reserved. * Copyright 2021 RackTop Systems, Inc. */ @@ -482,7 +482,6 @@ again: (void) mutex_lock(&smb_ads_cached_host_mtx); if (!smb_ads_cached_host_info) smb_ads_cached_host_info = smb_ads_dup_host_info(host); - host = smb_ads_dup_host_info(smb_ads_cached_host_info); (void) mutex_unlock(&smb_ads_cached_host_mtx); out: -- cgit v1.2.3