File rtl-sdr-0002-fix-rtlsdr_open-memory-leak.patch of Package rtl-sdr
From be1d1206bfb6e6c41f7d91b20b77e20f929fa6a7 Mon Sep 17 00:00:00 2001
From: Steve Markgraf <steve@steve-m.de>
Date: Tue, 16 Jul 2019 23:31:31 +0200
Subject: [PATCH] lib: fix memory leak in rtlsdr_open()
Thanks to Vincent Perrier for reporting the bug.
---
src/librtlsdr.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/librtlsdr.c b/src/librtlsdr.c
index 89ec903..d72a0f5 100644
--- a/src/librtlsdr.c
+++ b/src/librtlsdr.c
@@ -1628,6 +1628,9 @@ int rtlsdr_open(rtlsdr_dev_t **out_dev, uint32_t index)
return 0;
err:
if (dev) {
+ if (dev->devh)
+ libusb_close(dev->devh);
+
if (dev->ctx)
libusb_exit(dev->ctx);