From 0b6bc8f07456ea4cad45a064abb0c4d9ca62bf68 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Fri, 22 May 2020 10:33:33 -0700 Subject: [PATCH] Clear the structure memory on exiting libx52 --- lib/libx52/x52_core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/libx52/x52_core.c b/lib/libx52/x52_core.c index 85114cd..297149e 100644 --- a/lib/libx52/x52_core.c +++ b/lib/libx52/x52_core.c @@ -125,6 +125,10 @@ void libx52_exit(libx52_device *dev) { libusb_close(dev->hdl); libusb_exit(dev->ctx); + + /* Clear the memory to prevent reuse */ + memset(dev, 0, sizeof(*dev)); + free(dev); }