Skip to content

Commit

Permalink
Fix for null dereference if a socket is closed without having been op…
Browse files Browse the repository at this point in the history
…ened
  • Loading branch information
SimonChisholm committed Aug 17, 2016
1 parent 15f541e commit bd9c14d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions OpenHome/Network.cpp
Expand Up @@ -183,9 +183,12 @@ void Socket::Close()
// close connection and allow caller to handle any exceptions
LOGF(kNetwork, "Socket::Close H = %d\n", iHandle);
iLock.Wait();
TInt err = OpenHome::Os::NetworkClose(iHandle);
TInt err = 0;
THandle handle = iHandle;
iHandle = kHandleNull;
if (iHandle != kHandleNull){
err = OpenHome::Os::NetworkClose(iHandle);
iHandle = kHandleNull;
}
iLock.Signal();
if(err != 0) {
LOG2F(kNetwork, kError, "Socket::Close H = %d, RETURN VALUE = %d\n", handle, err);
Expand Down

0 comments on commit bd9c14d

Please sign in to comment.