changeset 14152:46f5fb0b0d36

4061 libzfs: memory leak in iter_dependents_cb() Reviewed by: Jeffry Molanus <jeffry.molanus@nexenta.com> Reviewed by: Boris Protopopov <boris.protopopov@nexenta.com> Reviewed by: Andy Stormont <andyjstormont@gmail.com> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Approved by: Dan McDonald <danmcd@nexenta.com>
author Marcel Telka <marcel.telka@nexenta.com>
date Thu, 15 Aug 2013 22:33:42 +0200
parents 189ec27885ae
children f1218363a3c7
files usr/src/lib/libzfs/common/libzfs_iter.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/lib/libzfs/common/libzfs_iter.c	Tue Aug 20 20:11:52 2013 -0800
+++ b/usr/src/lib/libzfs/common/libzfs_iter.c	Thu Aug 15 22:33:42 2013 +0200
@@ -21,8 +21,8 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
  * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  */
 
 #include <stdio.h>
@@ -443,8 +443,12 @@
 			err = zfs_iter_snapshots(zhp, iter_dependents_cb, ida);
 		ida->stack = isf.next;
 	}
+
 	if (!first && err == 0)
 		err = ida->func(zhp, ida->data);
+	else
+		zfs_close(zhp);
+
 	return (err);
 }