Project

General

Profile

Bug #4061

libzfs: memory leak in iter_dependents_cb()

Added by Marcel Telka about 6 years ago. Updated about 6 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
zfs - Zettabyte File System
Start date:
2013-08-20
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage

Description

There is a memory leak in iter_dependents_cb(). It is expected that the iter_dependents_cb() calls zfs_close() for the passed zhp. It is true for all codepaths, except this one:

446    if (!first && err == 0)
447        err = ida->func(zhp, ida->data);
448    return (err);

The ida->func() is calling the zfs_close(zhp) too, but in a case the condition at line 446 is false the zfs_close() is not called.

To reproduce the issue download attached leaks_rename.c and leaks_rename.sh and run leaks_rename.sh.


Files

leaks_rename.sh (466 Bytes) leaks_rename.sh Marcel Telka, 2013-08-20 02:51 PM
leaks_rename.c (995 Bytes) leaks_rename.c Marcel Telka, 2013-08-20 02:51 PM

History

#1

Updated by Marcel Telka about 6 years ago

  • Status changed from In Progress to Pending RTI
#2

Updated by Marcel Telka about 6 years ago

  • Status changed from Pending RTI to Resolved
  • % Done changed from 0 to 100

Resolved in:

commit 2fbdf8dbf01ec1c85fcd3827cdf9e9f5f46c4c8a
Author: Marcel Telka <marcel.telka@nexenta.com>
Date:   Thu Aug 15 22:33:42 2013 +0200

    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>

Also available in: Atom PDF