Browse Source

For a load of modules: free struct members in MOD_UNLOAD as well for good measure, also changed some error strings to be consistent with all the rest

Wazakindjes 3 years ago
parent
commit
7f56bf20ce

+ 1 - 0
spec/m_mafiareturns.c

@@ -93,6 +93,7 @@ MOD_UNLOAD(m_mafiareturns) {
 		// This shit is a bit convoluted to prevent memory issues obv famalmalmalmlmalm
 		while((chan = muhcfg.channels) != NULL) {
 			muhcfg.channels = muhcfg.channels->next;
+			if(chan->name) free(chan->name);
 			free(chan);
 		}
 		muhcfg.channels = NULL; // Let's be explicit lol

+ 2 - 2
templates/conf.c

@@ -153,13 +153,13 @@ int MODNAME_configtest(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) {
 		if(!strcmp(cep->ce_varname, "intoption")) {
 			// Should be an integer yo
 			if(!cep->ce_vardata) {
-				config_error("%s:%i: %s::%s must be an integer of zero or larger m8", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, MYCONF, cep->ce_varname);
+				config_error("%s:%i: %s::%s must be an integer of 0 or larger m8", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, MYCONF, cep->ce_varname);
 				errors++; // Increment err0r count fam
 				continue;
 			}
 			for(i = 0; cep->ce_vardata[i]; i++) {
 				if(!isdigit(cep->ce_vardata[i])) {
-					config_error("%s:%i: %s::%s must be an integer of zero or larger m8", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, MYCONF, cep->ce_varname);
+					config_error("%s:%i: %s::%s must be an integer of 0 or larger m8", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, MYCONF, cep->ce_varname);
 					errors++; // Increment err0r count fam
 					break;
 				}

+ 1 - 1
u4/m_anticaps.c

@@ -110,7 +110,7 @@ int anticaps_configtest(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) {
 		if(!strcmp(cep->ce_varname, "minlength")) {
 			for(i = 0; cep->ce_vardata[i]; i++) {
 				if(!isdigit(cep->ce_vardata[i])) {
-					config_error("%s:%i: %s::minlength must be an integer of zero or larger m8", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, MYCONF);
+					config_error("%s:%i: %s::minlength must be an integer of 0 or larger m8", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, MYCONF);
 					errors++; // Increment err0r count fam
 					break;
 				}

+ 1 - 0
u4/m_autojoin_byport.c

@@ -80,6 +80,7 @@ MOD_UNLOAD(m_autojoin_byport) {
 		AJPort *ajEntry;
 		while((ajEntry = ajoinpList) != NULL) {
 			ajoinpList = ajoinpList->next;
+			if(ajEntry->channel) free(ajEntry->channel);
 			free(ajEntry);
 		}
 		ajoinpList = NULL;

+ 2 - 0
u4/m_autovhost.c

@@ -76,6 +76,8 @@ MOD_UNLOAD(m_autovhost) {
 		vhostEntry *vEntry;
 		while((vEntry = vhostList) != NULL) {
 			vhostList = vhostList->next;
+			if(vEntry->mask) free(vEntry->mask);
+			if(vEntry->vhost) free(vEntry->vhost);
 			free(vEntry);
 		}
 		vhostList = NULL;

+ 1 - 0
u4/m_denyban.c

@@ -89,6 +89,7 @@ MOD_UNLOAD(m_denyban) {
 		denyBan *dbEntry;
 		while((dbEntry = denyBanList) != NULL) {
 			denyBanList = denyBanList->next;
+			if(dbEntry->mask) free(dbEntry->mask);
 			free(dbEntry);
 		}
 		denyBanList = NULL;

+ 2 - 0
u4/m_fantasy.c

@@ -86,6 +86,8 @@ MOD_UNLOAD(m_fantasy) {
 		fantasyCmd *fCmd;
 		while((fCmd = fantasyList) != NULL) {
 			fantasyList = fantasyList->next;
+			if(fCmd->alias) free(fCmd->alias);
+			if(fCmd->cmdstr) free(fCmd->cmdstr);
 			free(fCmd);
 		}
 		fantasyList = NULL;

+ 2 - 2
u4/m_nick_minlen.c

@@ -123,13 +123,13 @@ int minlen_configtest(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) {
 
 	// Should be an integer yo
 	if(!ce->ce_vardata) {
-		config_error("%s:%i: set::%s must be an integer of zero or larger m8", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, MYCONF);
+		config_error("%s:%i: set::%s must be an integer of 0 or larger m8", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, MYCONF);
 		errors++; // Increment err0r count fam
 	}
 	else {
 		for(i = 0; ce->ce_vardata[i]; i++) {
 			if(!isdigit(ce->ce_vardata[i])) {
-				config_error("%s:%i: set::%s must be an integer of zero or larger m8", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, MYCONF);
+				config_error("%s:%i: set::%s must be an integer of 0 or larger m8", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, MYCONF);
 				errors++; // Increment err0r count fam
 				break;
 			}

+ 1 - 0
u4/m_noghosts.c

@@ -97,6 +97,7 @@ MOD_UNLOAD(m_noghosts) {
 		muhchan *ch;
 		while((ch = muhcfg.channels) != NULL) {
 			muhcfg.channels = muhcfg.channels->next;
+			if(ch->name) free(ch->name);
 			free(ch);
 		}
 		muhcfg.channels = NULL;

+ 2 - 2
u4/m_pmlist.c

@@ -575,13 +575,13 @@ int pmlist_configtest(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) {
 		if(!strcmp(cep->ce_varname, "noticedelay")) {
 			// Should be an integer yo
 			if(!cep->ce_vardata) {
-				config_error("%s:%i: %s::%s must be an integer of zero or larger m8", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, MYCONF, cep->ce_varname);
+				config_error("%s:%i: %s::%s must be an integer of 0 or larger m8", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, MYCONF, cep->ce_varname);
 				errors++; // Increment err0r count fam
 				continue;
 			}
 			for(i = 0; cep->ce_vardata[i]; i++) {
 				if(!isdigit(cep->ce_vardata[i])) {
-					config_error("%s:%i: %s::%s must be an integer of zero or larger m8", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, MYCONF, cep->ce_varname);
+					config_error("%s:%i: %s::%s must be an integer of 0 or larger m8", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, MYCONF, cep->ce_varname);
 					errors++; // Increment err0r count fam
 					break;
 				}

+ 3 - 2
u4/m_websocket_restrict.c

@@ -91,6 +91,7 @@ MOD_UNLOAD(m_websocket_restrict) {
 		muhchan *ch;
 		while((ch = chanList) != NULL) {
 			chanList = chanList->next;
+			if(ch->name) free(ch->name);
 			free(ch);
 		}
 		chanList = NULL;
@@ -261,13 +262,13 @@ int websocket_restrict_configtest(ConfigFile *cf, ConfigEntry *ce, int type, int
 		if(!strcmp(cep->ce_varname, "zlinetime")) {
 			// Should be an integer yo
 			if(!cep->ce_vardata) {
-				config_error("%s:%i: %s::zlinetime must be an integer of zero or larger m8", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, MYCONF);
+				config_error("%s:%i: %s::zlinetime must be an integer of 0 or larger m8", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, MYCONF);
 				errors++; // Increment err0r count fam
 				continue;
 			}
 			for(i = 0; cep->ce_vardata[i]; i++) {
 				if(!isdigit(cep->ce_vardata[i])) {
-					config_error("%s:%i: %s::zlinetime must be an integer of zero or larger m8", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, MYCONF);
+					config_error("%s:%i: %s::zlinetime must be an integer of 0 or larger m8", cep->ce_fileptr->cf_filename, cep->ce_varlinenum, MYCONF);
 					errors++; // Increment err0r count fam
 					break;
 				}

+ 2 - 0
uncommon/m_confprot.c

@@ -175,6 +175,8 @@ MOD_UNLOAD(m_confprot) {
 		protEntry *pEntry;
 		while((pEntry = protList) != NULL) {
 			protList = protList->next;
+			if(pEntry->server) free(pEntry->server);
+			if(pEntry->url) free(pEntry->url);
 			free(pEntry);
 		}
 		protList = NULL;

+ 3 - 2
uncommon/m_repeatprot.c

@@ -124,6 +124,7 @@ MOD_UNLOAD(m_repeatprot) {
 		muhExcept *exEntry;
 		while((exEntry = exceptionList) != NULL) {
 			exceptionList = exceptionList->next;
+			if(exEntry->mask) free(exEntry->mask);
 			free(exEntry);
 		}
 		exceptionList = NULL;
@@ -194,13 +195,13 @@ int repeatprot_configtest(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
 		if(!strcmp(cep->ce_varname, "threshold")) {
 			// Should be an integer yo
 			if(!cep->ce_vardata) {
-				config_error("%s:%i: repeatprot::threshold must be an integer of zero or larger m8", cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+				config_error("%s:%i: repeatprot::threshold must be an integer of 0 or larger m8", cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
 				errors++; // Increment err0r count fam
 				continue;
 			}
 			for(i = 0; cep->ce_vardata[i]; i++) {
 				if(!isdigit(cep->ce_vardata[i])) {
-					config_error("%s:%i: repeatprot::threshold must be an integer of zero or larger m8", cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
+					config_error("%s:%i: repeatprot::threshold must be an integer of 0 or larger m8", cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
 					errors++; // Increment err0r count fam
 					break;
 				}