diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | main.c | 8 |
2 files changed, 7 insertions, 3 deletions
@@ -1,6 +1,6 @@ DESTDIR=/ CC = cc -cflags = -O0 -Wall -I. -Wextra -pedantic -g $(shell pkg-config --cflags libstrophe) +cflags = -O0 -Wall -I. -Wformat-security -Wextra -pedantic -g $(shell pkg-config --cflags libstrophe) SRCFILE = main.c CFGFILE = ircxmpp.conf CFGDEST = ircxmpp @@ -107,7 +107,8 @@ void bridge_forward (const char * from, const char * msg, struct ircxmpp * ircxm irc_cmd_msg(bridge->irc, ircxmpp->channel, msg); irc_run_once(bridge); } else if (msg) { - bridge->messages = realloc(bridge->messages, bridge->messages_length+1); + bridge->messages = realloc(bridge->messages, + sizeof(*bridge->messages) * (bridge->messages_length+1)); bridge->messages[bridge->messages_length++] = strdup(msg); } } /* msg can be NULL, in that case we only join. */ @@ -237,7 +238,7 @@ void dump_event (irc_session_t * s, const char * e, const char * o, const char * for (unsigned int i = 0; i < c; i++) { if (i) fprintf(stderr, "|"); - fprintf(stderr, p[i]); + fprintf(stderr, "%s", p[i]); } fprintf(stderr, "]\n"); } @@ -595,6 +596,9 @@ cont: xmpp_conn_release(ircxmpp.conn); xmpp_ctx_free(ircxmpp.ctx); xmpp_shutdown(); + irc_cmd_quit(ircxmpp.irc, "vsesplošni izklop programa"); + irc_run_once_control(&ircxmpp); // verjetno je to potrebno, da pošlje quit + irc_destroy_session(ircxmpp.irc); free(ircxmpp.ircnick); free(ircxmpp.irchost); return 0; |