summaryrefslogtreecommitdiffstats
path: root/module/nvpair/nvpair.c
diff options
context:
space:
mode:
Diffstat (limited to 'module/nvpair/nvpair.c')
-rw-r--r--module/nvpair/nvpair.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/module/nvpair/nvpair.c b/module/nvpair/nvpair.c
index 2e3820981..8e654053c 100644
--- a/module/nvpair/nvpair.c
+++ b/module/nvpair/nvpair.c
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2015, 2016 by Delphix. All rights reserved.
+ * Copyright (c) 2015, 2017 by Delphix. All rights reserved.
*/
#include <sys/stropts.h>
@@ -2200,8 +2200,10 @@ nvs_embedded(nvstream_t *nvs, nvlist_t *embedded)
nvlist_init(embedded, embedded->nvl_nvflag, priv);
- if (nvs->nvs_recursion >= nvpair_max_recursion)
+ if (nvs->nvs_recursion >= nvpair_max_recursion) {
+ nvlist_free(embedded);
return (EINVAL);
+ }
nvs->nvs_recursion++;
if ((err = nvs_operation(nvs, embedded, NULL)) != 0)
nvlist_free(embedded);