From 5c317f1313204c5731b0de5c7984e3725738f9d6 Mon Sep 17 00:00:00 2001 From: Simon Arlott Date: Sat, 23 Apr 2016 23:56:41 +0100 Subject: [PATCH] ircd: parse: add asserts for improper use of mod_add_cmd/mod_del_cmd --- ircd/parse.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ircd/parse.c b/ircd/parse.c index e09dbe38..9af59791 100644 --- a/ircd/parse.c +++ b/ircd/parse.c @@ -295,8 +295,10 @@ mod_add_cmd(struct Message *msg) if(msg == NULL) return; - if (rb_dictionary_find(cmd_dict, msg->cmd) != NULL) + if (rb_dictionary_find(cmd_dict, msg->cmd) != NULL) { + s_assert(0); return; + } msg->count = 0; msg->rcount = 0; @@ -318,7 +320,8 @@ mod_del_cmd(struct Message *msg) if(msg == NULL) return; - rb_dictionary_delete(cmd_dict, msg->cmd); + if (rb_dictionary_delete(cmd_dict, msg->cmd) == NULL) + s_assert(0); } /* cancel_clients()