summaryrefslogtreecommitdiff
path: root/src/modules/m_ident.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-13 22:58:16 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-13 22:58:16 +0000
commit178d4697c55c7c4c932d6e1564815f3ab0a1a6d2 (patch)
tree48c3c398134a2996feffb960cf77671568275e92 /src/modules/m_ident.cpp
parent7330b6579e4fe6719a4d214dd0ea994015fdd5da (diff)
Fixes for potential 4 byte memory leak, and crash
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8169 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_ident.cpp')
-rw-r--r--src/modules/m_ident.cpp30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp
index f522f6719..6f0f3b557 100644
--- a/src/modules/m_ident.cpp
+++ b/src/modules/m_ident.cpp
@@ -277,27 +277,39 @@ class ModuleIdent : public Module
if (user->GetExt("ident_socket", isock))
{
int *fd;
- if (user->GetExt("ident_socket_fd", fd) && (ServerInstance->SE->GetRef(*fd) == isock))
+ if (user->GetExt("ident_socket_fd", fd))
{
- user->Shrink("ident_socket_fd");
- delete fd;
- isock->Close();
+ if (ServerInstance->SE->GetRef(*fd) == isock)
+ isock->Close();
+
+ /* Check again, isock->Close() can confuse us */
+ if (user->GetExt("ident_socket_fd", fd))
+ {
+ user->Shrink("ident_socket_fd");
+ delete fd;
+ }
}
}
}
}
-
+
virtual void OnUserDisconnect(userrec *user)
{
IdentRequestSocket *isock;
if (user->GetExt("ident_socket", isock))
{
int *fd;
- if (user->GetExt("ident_socket_fd", fd) && (ServerInstance->SE->GetRef(*fd) == isock))
+ if (user->GetExt("ident_socket_fd", fd))
{
- user->Shrink("ident_socket_fd");
- delete fd;
- isock->Close();
+ if (ServerInstance->SE->GetRef(*fd) == isock)
+ isock->Close();
+
+ /* Check again, isock->Close() can confuse us */
+ if (user->GetExt("ident_socket_fd", fd))
+ {
+ user->Shrink("ident_socket_fd");
+ delete fd;
+ }
}
}
}