]> jfr.im git - irc/unrealircd/unrealircd.git/commitdiff
Fix memory leak in dead socket handling.
authorBram Matthys <redacted>
Mon, 11 Jun 2018 06:02:07 +0000 (08:02 +0200)
committerBram Matthys <redacted>
Mon, 11 Jun 2018 06:02:07 +0000 (08:02 +0200)
src/send.c

index 755990f8e01c879267406e4eb167a617c96b1d83..51a54969a18f6e51a8855d399a063fca44d4f919 100644 (file)
@@ -75,10 +75,16 @@ int dead_link(aClient *to, char *notice)
        DBufClear(&to->local->recvQ);
        DBufClear(&to->local->sendQ);
 
-       if ((to->flags & FLAGS_DEADSOCKET) && to->local->error_str)
+       if (to->flags & FLAGS_DEADSOCKET)
                return -1; /* already pending to be closed */
 
        to->flags |= FLAGS_DEADSOCKET;
+
+       /* We may get here because of the 'CPR' in check_deadsockets().
+        * In which case, we return -1 as well.
+        */
+       if (to->local->error_str)
+               return -1; /* don't overwrite & don't send multiple times */
        
        if (!IsPerson(to) && !IsUnknown(to) && !(to->flags & FLAGS_CLOSING))
                sendto_umode(UMODE_OPER, "Closing link: %s - %s",