mirror of
https://github.com/emersion/kanshi
synced 2024-11-22 15:51:58 +01:00
Don't strdup command line arguments.
They live forever, so there's no need to manage them with dynamic memory.
This commit is contained in:
parent
2c66d57ed0
commit
b6613c2eac
7
main.c
7
main.c
@ -488,14 +488,13 @@ static const struct option long_options[] = {
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
char *config_arg = NULL;
|
||||
const char *config_arg = NULL;
|
||||
|
||||
int opt;
|
||||
while ((opt = getopt_long(argc, argv, "hc:", long_options, NULL)) != -1) {
|
||||
switch (opt) {
|
||||
case 'c':
|
||||
free(config_arg);
|
||||
config_arg = strdup(optarg);
|
||||
config_arg = optarg;
|
||||
break;
|
||||
case 'h':
|
||||
fprintf(stderr, usage, argv[0]);
|
||||
@ -511,8 +510,6 @@ int main(int argc, char *argv[]) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
free(config_arg);
|
||||
|
||||
struct wl_display *display = wl_display_connect(NULL);
|
||||
if (display == NULL) {
|
||||
fprintf(stderr, "failed to connect to display\n");
|
||||
|
Loading…
Reference in New Issue
Block a user