Do not free const string port

weechat-hashes
Curtis McEnroe 2018-08-04 13:43:36 -04:00
parent ccdeb0c556
commit 5217f876b0
No known key found for this signature in database
GPG Key ID: CEA2F97ADCFCD77C
1 changed files with 2 additions and 3 deletions

5
chat.c
View File

@ -46,7 +46,7 @@ char *prompt(const char *prompt) {
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
char *host = NULL; char *host = NULL;
char *port = "6697"; const char *port = "6697";
const char *webPass = NULL; const char *webPass = NULL;
int opt; int opt;
@ -55,7 +55,7 @@ int main(int argc, char *argv[]) {
break; case 'h': host = strdup(optarg); break; case 'h': host = strdup(optarg);
break; case 'j': chat.chan = strdup(optarg); break; case 'j': chat.chan = strdup(optarg);
break; case 'n': chat.nick = strdup(optarg); break; case 'n': chat.nick = strdup(optarg);
break; case 'p': port = strdup(optarg); break; case 'p': port = optarg;
break; case 'v': chat.verbose = true; break; case 'v': chat.verbose = true;
break; case 'w': webPass = optarg; break; case 'w': webPass = optarg;
break; default: return EX_USAGE; break; default: return EX_USAGE;
@ -73,7 +73,6 @@ int main(int argc, char *argv[]) {
int sock = clientConnect(host, port, webPass); int sock = clientConnect(host, port, webPass);
free(host); free(host);
free(port);
struct pollfd fds[2] = { struct pollfd fds[2] = {
{ .fd = STDIN_FILENO, .events = POLLIN }, { .fd = STDIN_FILENO, .events = POLLIN },