mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-10-17 05:07:28 +08:00
fix: close when throw exception (#6019)
This commit is contained in:
+6
-1
@@ -1993,11 +1993,16 @@ def getLocalIP():
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.connect((conf.hostname, conf.port))
|
||||
retVal, _ = s.getsockname()
|
||||
s.close()
|
||||
except:
|
||||
debugMsg = "there was an error in opening socket "
|
||||
debugMsg += "connection toward '%s'" % conf.hostname
|
||||
logger.debug(debugMsg)
|
||||
finally:
|
||||
if s:
|
||||
try:
|
||||
s.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
return retVal
|
||||
|
||||
|
||||
Reference in New Issue
Block a user