diff options
author | heary-cao <[email protected]> | 2016-08-06 15:08:51 +0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-08-19 11:17:12 -0700 |
commit | ee6370a7a48e416cbd44819d007fdaba120a328d (patch) | |
tree | f4e9a84c7fea7ab14d0fd2146ff71d1d5345422e /module/zfs/spa.c | |
parent | 5a5170884a6131c9f4346dd130d50a945d425853 (diff) |
Fix spa config generate memory leak in spa_load_best function
When spa retry load succeeds and spa recovery is requested it may
leak in spa_load_best function. Always free the generated config
when it is not assigned to the spa.
Signed-off-by: cao.xuewen <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #4940
Diffstat (limited to 'module/zfs/spa.c')
-rw-r--r-- | module/zfs/spa.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/module/zfs/spa.c b/module/zfs/spa.c index da238a398..3b63427c2 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -3095,6 +3095,8 @@ spa_load_best(spa_t *spa, spa_load_state_t state, int mosconfig, if (config && (rewind_error || state != SPA_LOAD_RECOVER)) spa_config_set(spa, config); + else + nvlist_free(config); if (state == SPA_LOAD_RECOVER) { ASSERT3P(loadinfo, ==, NULL); |