summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libnv/nvpair.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/libnv/nvpair.c b/lib/libnv/nvpair.c
index a6a2a00..916444f 100644
--- a/lib/libnv/nvpair.c
+++ b/lib/libnv/nvpair.c
@@ -683,10 +683,8 @@ nvpair_unpack(int flags, const unsigned char *ptr, size_t *leftp,
if (ptr == NULL)
goto failed;
tmp = realloc(nvp, sizeof(*nvp) + strlen(nvp->nvp_name) + 1);
- if (tmp == NULL) {
- free(nvp);
+ if (tmp == NULL)
goto failed;
- }
nvp = tmp;
/* Update nvp_name after realloc(). */
nvp->nvp_name = (char *)(nvp + 1);
OpenPOWER on IntegriCloud