Skip to content

Commit 186aa17

Browse files
committed
fix stop_filter memory leak
1 parent e2092ae commit 186aa17

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scapy/sendrecv.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,8 @@ def sniff(count=0, store=True, offline=None, prn=None, lfilter=None,
850850
try:
851851
if started_callback:
852852
started_callback()
853-
while sniff_sockets:
853+
continue_sniff = True
854+
while sniff_sockets and continue_sniff:
854855
if timeout is not None:
855856
remain = stoptime - time.time()
856857
if remain <= 0:
@@ -880,10 +881,10 @@ def sniff(count=0, store=True, offline=None, prn=None, lfilter=None,
880881
# on_packet_received handles the prn/storage
881882
session.on_packet_received(p)
882883
if stop_filter and stop_filter(p):
883-
sniff_sockets = []
884+
continue_sniff = False
884885
break
885886
if 0 < count <= c:
886-
sniff_sockets = []
887+
continue_sniff = False
887888
break
888889
except KeyboardInterrupt:
889890
pass

0 commit comments

Comments
 (0)