summaryrefslogtreecommitdiffstats
path: root/module/zfs/dsl_prop.c
diff options
context:
space:
mode:
authorBearBabyLiu <[email protected]>2016-11-03 03:34:10 +0800
committerBrian Behlendorf <[email protected]>2016-11-02 12:34:10 -0700
commit6d4210052be6c63032d693aa487f84955b0dae44 (patch)
tree67cfc89728b3f6855ee5f18f0bf15845f7c3f74b /module/zfs/dsl_prop.c
parente676a196249b5e8d23c036548f189cad60d5cd2a (diff)
Fix dsl_prop_get_all_dsl() memory leak
On error dsl_prop_get_all_ds() does not free the nvlist it allocates. This behavior may have been intentional when originally written but is atypical and often confusing. Since no callers rely on this behavior the function has been updated to always free the nvlist on error. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: BearBabyLiu <[email protected]> Closes #5320
Diffstat (limited to 'module/zfs/dsl_prop.c')
-rw-r--r--module/zfs/dsl_prop.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/module/zfs/dsl_prop.c b/module/zfs/dsl_prop.c
index 24836000f..ece1e1975 100644
--- a/module/zfs/dsl_prop.c
+++ b/module/zfs/dsl_prop.c
@@ -1127,6 +1127,10 @@ dsl_prop_get_all_ds(dsl_dataset_t *ds, nvlist_t **nvp,
break;
}
out:
+ if (err) {
+ nvlist_free(*nvp);
+ *nvp = NULL;
+ }
return (err);
}