gluon-announced: do not strdup optarg

This commit is contained in:
Nils Schneider 2014-08-04 18:26:35 +02:00
parent a7a8f37308
commit 74dfce8a30

View File

@ -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;
}