From 4690dd6f00c3f26f3ab17138c0e50231f2dfc83b Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Fri, 17 Nov 2017 23:53:46 +0100 Subject: [PATCH] Copy object contents from buffers on instantiation - this may fix some memory issues --- src/network/bmobject.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/network/bmobject.py b/src/network/bmobject.py index f4c883ca..249ec2ab 100644 --- a/src/network/bmobject.py +++ b/src/network/bmobject.py @@ -40,8 +40,9 @@ class BMObject(object): self.version = version self.streamNumber = streamNumber self.inventoryHash = calculateInventoryHash(data) - self.data = data - self.tag = data[payloadOffset:payloadOffset+32] + # copy to avoid memory issues + self.data = bytearray(data) + self.tag = self.data[payloadOffset:payloadOffset+32] def checkProofOfWorkSufficient(self): # Let us check to make sure that the proof of work is sufficient.