Copy optarg string for fp_format_printf_str lest it be messed
later.
Lustre-change: https://review.whamcloud.com/50733
Lustre-commit:
75db98cef3df8f9a0e1b6e7a5150f3c332e6167b
Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Change-Id: Ib32883d3261ae921adf0fdd7b05bcbf728de7557
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/50690
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
case 'P': /* we always print, this option is a no-op */
break;
case LFS_PRINTF_OPT:
- param.fp_format_printf_str = optarg;
+ param.fp_format_printf_str = strdup(optarg);
break;
case LFS_PROJID_OPT:
rc = name2projid(¶m.fp_projid, optarg);
if (param.fp_mdt_uuid && param.fp_num_alloc_mdts)
free(param.fp_mdt_uuid);
+ if (param.fp_format_printf_str)
+ free(param.fp_format_printf_str);
+
return ret;
}