]> jfr.im git - solanum.git/blobdiff - extensions/filter.c
Merge pull request #302 from edk0/sasl-usercloak
[solanum.git] / extensions / filter.c
index 8c91b0c8ff4d67b59811c0929968a4f781050ece..36c3e28831b3132fb1fcbeab86a9e2f1afec946a 100644 (file)
@@ -100,12 +100,13 @@ struct Message setfilter_msgtab = {
        {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, {me_setfilter, 2}, {mo_setfilter, 2}}
 };
 
-static void
+static int
 modinit(void)
 {
        filter_umode = user_modes['u'] = find_umode_slot();
        construct_umodebuf();
        filter_chmode = cflag_add('u', chm_simple);
+       return 0;
 }
 
 static void
@@ -205,6 +206,7 @@ setfilter(const char *check, const char *data, const char **error)
                r = hs_alloc_scratch(db, &filter_scratch);
                if (r != HS_SUCCESS) {
                        if (error) *error = "couldn't allocate scratch";
+                       hs_free_database(db);
                        return -1;
                }
                if (filter_db) {
@@ -229,7 +231,7 @@ setfilter(const char *check, const char *data, const char **error)
 
        if (state == FILTER_FILLING) {
                int dl;
-               unsigned char *d = rb_base64_decode(data, strlen(data), &dl);
+               unsigned char *d = rb_base64_decode((unsigned char *)data, strlen(data), &dl);
                if (!d) {
                        if (error) *error = "invalid data";
                        return -1;