Whamcloud - gitweb
LU-16154 obdclass: free inst_name correctly 42/48542/4
authorEmoly Liu <emoly@whamcloud.com>
Thu, 15 Sep 2022 01:42:47 +0000 (09:42 +0800)
committerOleg Drokin <green@whamcloud.com>
Sat, 24 Sep 2022 20:28:50 +0000 (20:28 +0000)
In functon class_config_llog_handler(), inst_name should be freed
correctly before break.

Signed-off-by: Emoly Liu <emoly@whamcloud.com>
Change-Id: I6adc0ed62c3c637237834b799f25666d0e7e1ecb
Reviewed-on: https://review.whamcloud.com/48542
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Zhenyu Xu <bobijam@hotmail.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/obdclass/obd_config.c

index 89dbe02..f8840b0 100644 (file)
@@ -1971,16 +1971,15 @@ int class_config_llog_handler(const struct lu_env *env,
                            libcfs_str2net(lsi->lsi_lmd->lmd_nidnet)) {
                                CDEBUG(D_CONFIG, "skipping add_conn for %s\n",
                                       uuid_str);
                            libcfs_str2net(lsi->lsi_lmd->lmd_nidnet)) {
                                CDEBUG(D_CONFIG, "skipping add_conn for %s\n",
                                       uuid_str);
-                               rc = 0;
                                /* No processing! */
                                /* No processing! */
-                               break;
+                               GOTO(out_inst, rc = 0);
                        }
                }
 
                OBD_ALLOC(lcfg_new, lustre_cfg_len(bufs.lcfg_bufcount,
                                                   bufs.lcfg_buflen));
                if (!lcfg_new)
                        }
                }
 
                OBD_ALLOC(lcfg_new, lustre_cfg_len(bufs.lcfg_bufcount,
                                                   bufs.lcfg_buflen));
                if (!lcfg_new)
-                       GOTO(out, rc = -ENOMEM);
+                       GOTO(out_inst, rc = -ENOMEM);
 
                lustre_cfg_init(lcfg_new, lcfg->lcfg_command, &bufs);
                lcfg_new->lcfg_num   = lcfg->lcfg_num;
 
                lustre_cfg_init(lcfg_new, lcfg->lcfg_command, &bufs);
                lcfg_new->lcfg_num   = lcfg->lcfg_num;
@@ -2008,6 +2007,7 @@ int class_config_llog_handler(const struct lu_env *env,
                rc = class_process_config(lcfg_new);
                OBD_FREE(lcfg_new, lustre_cfg_len(lcfg_new->lcfg_bufcount,
                                                  lcfg_new->lcfg_buflens));
                rc = class_process_config(lcfg_new);
                OBD_FREE(lcfg_new, lustre_cfg_len(lcfg_new->lcfg_bufcount,
                                                  lcfg_new->lcfg_buflens));
+out_inst:
                if (inst_name)
                        OBD_FREE(inst_name, inst_len);
                break;
                if (inst_name)
                        OBD_FREE(inst_name, inst_len);
                break;