소스 검색

Input: ims-pcu - fix a memory leak on error

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Dmitry Torokhov 12 년 전
부모
커밋
3c2b901003
1개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 2
      drivers/input/misc/ims-pcu.c

+ 3 - 2
drivers/input/misc/ims-pcu.c

@@ -292,7 +292,8 @@ static int ims_pcu_setup_gamepad(struct ims_pcu *pcu)
 	if (!gamepad || !input) {
 	if (!gamepad || !input) {
 		dev_err(pcu->dev,
 		dev_err(pcu->dev,
 			"Not enough memory for gamepad device\n");
 			"Not enough memory for gamepad device\n");
-		return -ENOMEM;
+		error = -ENOMEM;
+		goto err_free_mem;
 	}
 	}
 
 
 	gamepad->input = input;
 	gamepad->input = input;
@@ -1156,7 +1157,7 @@ static ssize_t ims_pcu_update_firmware_store(struct device *dev,
 {
 {
 	struct usb_interface *intf = to_usb_interface(dev);
 	struct usb_interface *intf = to_usb_interface(dev);
 	struct ims_pcu *pcu = usb_get_intfdata(intf);
 	struct ims_pcu *pcu = usb_get_intfdata(intf);
-	const struct firmware *fw;
+	const struct firmware *fw = NULL;
 	int value;
 	int value;
 	int error;
 	int error;