Skip to contentSkip to conversation

wireless: purelifi: plfxlc: fix memory in plfxlc_usb_wreq_asyn()

PATCH New Salah Triki 1 participant 1 message Apr 27, 2025 Purelifi plfxlc driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wireless: purelifi: plfxlc: fix memory in plfxlc_usb_wreq_asyn()

Add usb_free_urb() in the error path to prevent memory leak.

---
 drivers/net/wireless/purelifi/plfxlc/usb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/purelifi/plfxlc/usb.c +3 -1
index 10d2e2124ff8..c2a1234b59db 100644
@@ -503,8 +503,10 @@ int plfxlc_usb_wreq_async(struct plfxlc_usb *usb, const u8 *buffer,
 			  (void *)buffer, buffer_len, complete_fn, context);
 
 	r = usb_submit_urb(urb, GFP_ATOMIC);
-	if (r)
+	if (r) {
+		usb_free_urb(urb);
 		dev_err(&udev->dev, "Async write submit failed (%d)\n", r);
+	}
 
 	return r;
 }
Signature · 1 line
2.43.0