gluon-announced: do not strdup optarg
This commit is contained in:
parent
a7a8f37308
commit
74dfce8a30
@ -187,14 +187,8 @@ int main(int argc, char **argv) {
|
||||
group_set = 1;
|
||||
break;
|
||||
case 's':
|
||||
free(script); // in case -s is given multiple times
|
||||
script = optarg;
|
||||
|
||||
script = strdup(optarg);
|
||||
|
||||
if (script == NULL) {
|
||||
perror("Couldn't duplicate string");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
break;
|
||||
case 'i':
|
||||
if (!group_set) {
|
||||
@ -223,7 +217,5 @@ int main(int argc, char **argv) {
|
||||
|
||||
serve(sock, script);
|
||||
|
||||
free(script);
|
||||
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user