Merge pull request #1552 from ailin-nemui/tv2

initialise memory in ctcp ping reply
This commit is contained in:
ailin-nemui 2025-04-07 20:33:53 +00:00 committed by GitHub
commit 85bb6ef008
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -119,11 +119,10 @@ static void ctcp_default_reply(IRC_SERVER_REC *server, const char *data,
g_free(ctcp); g_free(ctcp);
} }
static void ctcp_ping_reply(IRC_SERVER_REC *server, const char *data, static void ctcp_ping_reply(IRC_SERVER_REC *server, const char *data, const char *nick,
const char *nick, const char *addr, const char *addr, const char *target)
const char *target)
{ {
gint64 tv, tv2; gint64 tv, tv2 = 0;
long usecs; long usecs;
g_return_if_fail(data != NULL); g_return_if_fail(data != NULL);
@ -141,8 +140,9 @@ static void ctcp_ping_reply(IRC_SERVER_REC *server, const char *data,
tv2 += tv * G_TIME_SPAN_SECOND; tv2 += tv * G_TIME_SPAN_SECOND;
tv = g_get_real_time(); tv = g_get_real_time();
usecs = tv - tv2; usecs = tv - tv2;
printformat(server, server_ischannel(SERVER(server), target) ? target : nick, MSGLEVEL_CTCPS, printformat(server, server_ischannel(SERVER(server), target) ? target : nick,
IRCTXT_CTCP_PING_REPLY, nick, usecs / G_TIME_SPAN_SECOND, usecs % G_TIME_SPAN_SECOND); MSGLEVEL_CTCPS, IRCTXT_CTCP_PING_REPLY, nick, usecs / G_TIME_SPAN_SECOND,
usecs % G_TIME_SPAN_SECOND);
} }
void fe_ctcp_init(void) void fe_ctcp_init(void)