commit 356a686a20feb3be4a8fbf9ba345e52751707f26
parent 7a08224d33d3bdb1b8f45665daa8b72dbc3fa168
Author: hhvn <dev@hhvn.uk>
Date: Sun, 20 Feb 2022 17:46:06 +0000
Free server->self after creating new one (nick_create will check server->self, and therefore segfault otherwise)
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/handle.c b/src/handle.c
@@ -415,13 +415,15 @@ handle_RPL_ENDOFNAMES(struct Server *server, struct History *msg) {
static void
handle_ERR_NICKNAMEINUSE(struct Server *server, struct History *msg) {
char nick[64]; /* should be limited to 9 chars, but newer servers *shrug*/
+ struct Nick *nnick;
hist_addp(server->history, msg, Activity_status, HIST_DFL);
if (expect_get(server, Expect_nicknameinuse) == NULL) {
snprintf(nick, sizeof(nick), "%s_", server->self->nick);
+ nnick = nick_create(nick, ' ', server);
nick_free(server->self);
- server->self = nick_create(nick, ' ', server);
+ server->self = nnick;
server->self->self = 1;
ircprintf(server, "NICK %s\r\n", nick);
} else {