]> granicus.if.org Git - zfs/commitdiff
Fix spa config generate memory leak in spa_load_best function
authorheary-cao <cao.xuewen@zte.com.cn>
Sat, 6 Aug 2016 07:08:51 +0000 (15:08 +0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 19 Aug 2016 18:17:12 +0000 (11:17 -0700)
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 <cao.xuewen@zte.com.cn>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #4940

module/zfs/spa.c

index da238a398b634cca915f4ae0b2ad7766d7b1262b..3b63427c2c96579f098dcbbc6253aa3575c1e94d 100644 (file)
@@ -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);