Project

General

Profile

Bug #4061

libzfs: memory leak in iter_dependents_cb()

Added by Marcel Telka over 7 years ago. Updated over 7 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
Gerrit CR:

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

Also available in: Atom PDF