Whamcloud - gitweb
LU-1399 config: check lustre_cfg_new() return
[fs/lustre-release.git] / lustre / utils / obd.c
index aa9117f..20ec5f4 100644 (file)
@@ -3209,9 +3209,9 @@ static int pool_cmd(enum lcfg_command_type cmd,
         if (ostname != NULL)
                 lustre_cfg_bufs_set_string(&bufs, 2, ostname);
 
-        lcfg = lustre_cfg_new(cmd, &bufs);
+       lcfg = lustre_cfg_new(cmd, &bufs);
        if (lcfg == NULL)
-               return rc;
+               return -ENOMEM;
 
         memset(&data, 0, sizeof(data));
         rc = data.ioc_dev = get_mgs_device();
@@ -3228,6 +3228,7 @@ static int pool_cmd(enum lcfg_command_type cmd,
         if (rc) {
                 fprintf(stderr, "error: %s: invalid ioctl\n",
                         jt_cmdname(cmdname));
+               lustre_cfg_free(lcfg);
                 return rc;
         }
         rc = l_ioctl(OBD_DEV_ID, OBD_IOC_POOL, buf);