]> jfr.im git - irc/quakenet/newserv.git/commitdiff
Some small fixes; don't double-free chanuser info lines, and free up mail domains...
authorsplidge <redacted>
Wed, 12 Mar 2008 01:24:29 +0000 (01:24 +0000)
committersplidge <redacted>
Wed, 12 Mar 2008 01:24:29 +0000 (01:24 +0000)
chanserv/chanservuser.c
chanserv/database/chanservdb_hash.c

index 03e0d890cd8c13c483cec658c863cb909472e1f4..f6ef33483d8ebbf6b756d5b6fc015b6990de0f6d 100644 (file)
@@ -1035,7 +1035,6 @@ void cs_removeuser(reguser *rup) {
   /* Remove the user from all its channels */
   for (rcup=rup->knownon;rcup;rcup=nrcup) {
     nrcup=rcup->nextbyuser;
-    freesstring(rcup->info);
     rcp=rcup->chan;
 
     delreguserfromchannel(rcp, rup);
index d06b7210a8ec0a6a2e4792104b799dd3f29a10b1..bbe3306ce5526f601e375ad6998cd87eaa4b0339 100644 (file)
@@ -315,7 +315,7 @@ void addregusertomaildomain(reguser *rup, maildomain *mdp) {
 }
 
 void delreguserfrommaildomain(reguser *rup, maildomain *mdp) {
-  maildomain *smdp;
+  maildomain *smdp, *nmdp;
   reguser *ruh, *pruh=NULL;
   int found=0;
 
@@ -341,16 +341,21 @@ void delreguserfrommaildomain(reguser *rup, maildomain *mdp) {
     return;
   }
 
-  for(smdp=mdp;smdp;smdp=smdp->parent) {
-    smdp->count--;
+  /* Free it from all the parent domains, cleaning up as we go.. */
+  for(smdp=mdp;smdp;smdp=nmdp) {
+    nmdp=smdp->parent;
+
+    /* Keep it if there are users left or we're remembering something about it. */    
+    if (--smdp->count || (smdp->flags != MDFLAG_DEFAULT) || (smdp->actlimit != MD_DEFAULTACTLIMIT))
+      continue;
+    
+    removemaildomainfromhash(smdp);
+    freesstring(smdp->name);
+    freemaildomain(smdp);
   }
+
   rup->domain=NULL;
   freesstring(rup->localpart);
   rup->localpart=NULL;
-
-  if (!mdp->count && !MDHasLimit(mdp)) {
-    removemaildomainfromhash(mdp);
-    freemaildomain(mdp);
-  }
 }