Browse Source

Free buf before exiting in case of unknown option while parsing the args in the command line

master
Aitor 10 months ago
parent
commit
df8f730173
  1. 7
      ui/main.cpp

7
ui/main.cpp

@ -211,7 +211,7 @@ void config_usage(const char *progname)
"Usage: %s [options]\n\n"
"Options:\n"
" -h --help this help\n"
" -c --card N select the hw:N card"
" -c --card N select the hw:N card\n"
" -D --device select the device, default 'default'\n"
" -s --systray run in the systray\n"
" -x --xpos x position\n"
@ -347,15 +347,18 @@ int main(int argc, char *argv[])
break;
case 'h':
config_usage(progname.c_str());
break;
free(buf);
return 0;
case '?':
if (isprint (optopt))
fprintf (stderr, "Unknown option `-%c'.\n", optopt);
else
fprintf (stderr, "Unknown option character `\\x%x'.\n",
optopt);
free(buf);
return 1;
default:
free(buf);
abort ();
} // switch

Loading…
Cancel
Save