I did digged the subject a bit more, it does seems like that the fix I provided is working properly, I have done a stress test of sending many different packets at many different sizes, with different
bytes structures and they were all being handled just fine, aswell as no any memory leak issue occurring.