The const pointer argument cannot be passed into libc function 'free()',
otherwise the compiler will complain following message:
nand-utils/nanddump.c:168:10: warning: passing argument 1 of ‘free’
discards ‘const’ qualifier from pointer target type
Fixes: c89009463888 ("nanddump: don't leak copied command line arguments")
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
{
int error = 0;
bool oob_default = true;
+ char *dumpfile_tmp = NULL;
for (;;) {
int option_index = 0;
start_addr = simple_strtoll(optarg, &error);
break;
case 'f':
- free(dumpfile);
- dumpfile = xstrdup(optarg);
+ free(dumpfile_tmp);
+ dumpfile = dumpfile_tmp = xstrdup(optarg);
break;
case 'l':
length = simple_strtoll(optarg, &error);