summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Gallagher <john.gallagher@delphix.com>2017-09-28 08:15:45 -0700
committerPrakash Surya <prakash.surya@delphix.com>2018-09-18 13:51:43 -0700
commite19b450bec203d8be04447ea476d7a86b36d63a1 (patch)
tree641e3738069ef1ec5edd7d15fda1945a8180f729
parent1946268f4b5e55d1de5a354a87463d24be6991ca (diff)
downloadillumos-joyent-e19b450bec203d8be04447ea476d7a86b36d63a1.tar.gz
8601 memory leak in get_special_prop()
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>
-rw-r--r--usr/src/uts/common/fs/zfs/zcp_get.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/usr/src/uts/common/fs/zfs/zcp_get.c b/usr/src/uts/common/fs/zfs/zcp_get.c
index 54e141d967..85e00a0f93 100644
--- a/usr/src/uts/common/fs/zfs/zcp_get.c
+++ b/usr/src/uts/common/fs/zfs/zcp_get.c
@@ -14,7 +14,7 @@
*/
/*
- * Copyright (c) 2016 by Delphix. All rights reserved.
+ * Copyright (c) 2016, 2017 by Delphix. All rights reserved.
*/
#include "lua.h"
@@ -422,16 +422,21 @@ get_special_prop(lua_State *state, dsl_dataset_t *ds, const char *dsname,
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);