]> granicus.if.org Git - zfs/commit
OpenZFS 9457 - libzfs_import.c:add_config() has a memory leak
authorsara hartse <sara.hartse@delphix.com>
Thu, 7 Sep 2017 20:10:53 +0000 (13:10 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 25 Jul 2018 00:12:06 +0000 (17:12 -0700)
commit473c976a0c4da84d8b49edaaf3d88a716d8dde2c
tree6e4f211c26508f8ca50f1a2e1843e990e34d8a8b
parent802b1a7b3b413486d4ff249f84c5e6cfd005ed55
OpenZFS 9457 - libzfs_import.c:add_config() has a memory leak

A memory leak occurs on lines 209 and 213 because the config is not
freed in the error case.  The interface to add_config() seems less than
ideal - it would be better if it copied any data necessary from the
config and the caller freed it.

Porting notes:
* This issue had already been resolved on Linux by adding the missing
  calls to nvlist_free().  But we'll adopt the upstream fix to keep
  the behavior of the code consistent.

Authored by: Sara Hartse <sara.hartse@delphix.com>
Reviewed by: Matt Ahrens <matt@delphix.com>
Reviewed by: Serapheim Dimitropoulos <serapheim.dimitro@delphix.com>
Reviewed by: Giuseppe Di Natale <guss80@gmail.com>
Reviewed by: George Melikov <mail@gmelikov.ru>
Approved by: Robert Mustacchi <rm@joyent.com>
Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
OpenZFS-issue: https://illumos.org/issues/9457
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/be86bb8a
Closes #7713
lib/libzfs/libzfs_import.c