Date: Mon, 3 Jun 2019 17:29:57 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r348559 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <201906031729.x53HTvl6036234@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Mon Jun 3 17:29:57 2019 New Revision: 348559 URL: https://svnweb.freebsd.org/changeset/base/348559 Log: MFV r348537: 8601 memory leak in get_special_prop() illumos/illumos-gate@e19b450bec203d8be04447ea476d7a86b36d63a1 Reviewed by: Serapheim Dimitropoulos <serapheim.dimitro@delphix.com> Reviewed by: Sara Hartse <sara.hartse@delphix.com> Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com> Reviewed by: Matt Ahrens <matt@delphix.com> Reviewed by: Robert Mustacchi <rm@joyent.com> Approved by: Dan McDonald <danmcd@joyent.com> Author: John Gallagher <john.gallagher@delphix.com> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_get.c Directory Properties: head/sys/cddl/contrib/opensolaris/ (props changed) Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_get.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_get.c Mon Jun 3 17:27:25 2019 (r348558) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp_get.c Mon Jun 3 17:29:57 2019 (r348559) @@ -14,7 +14,7 @@ */ /* - * Copyright (c) 2016 by Delphix. All rights reserved. + * Copyright (c) 2016, 2017 by Delphix. All rights reserved. */ #include "lua.h" @@ -431,16 +431,21 @@ get_special_prop(lua_State *state, dsl_dataset_t *ds, case ZFS_PROP_INCONSISTENT: numval = dsl_get_inconsistent(ds); break; - case ZFS_PROP_RECEIVE_RESUME_TOKEN: - VERIFY3U(strlcpy(strval, get_receive_resume_stats_impl(ds), - ZAP_MAXVALUELEN), <, ZAP_MAXVALUELEN); + case ZFS_PROP_RECEIVE_RESUME_TOKEN: { + char *token = get_receive_resume_stats_impl(ds); + VERIFY3U(strlcpy(strval, token, ZAP_MAXVALUELEN), <, + ZAP_MAXVALUELEN); + strfree(token); if (strcmp(strval, "") == 0) { - VERIFY3U(strlcpy(strval, get_child_receive_stats(ds), - ZAP_MAXVALUELEN), <, ZAP_MAXVALUELEN); + token = get_child_receive_stats(ds); + VERIFY3U(strlcpy(strval, token, ZAP_MAXVALUELEN), <, + ZAP_MAXVALUELEN); + strfree(token); if (strcmp(strval, "") == 0) error = ENOENT; } break; + } case ZFS_PROP_VOLSIZE: ASSERT(ds_type == ZFS_TYPE_VOLUME); error = dmu_objset_from_ds(ds, &os);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906031729.x53HTvl6036234>