crypto/ccp: fix resource leak
authorFerruh Yigit <ferruh.yigit@intel.com>
Sun, 28 Oct 2018 03:19:27 +0000 (03:19 +0000)
committerAkhil Goyal <akhil.goyal@nxp.com>
Mon, 12 Nov 2018 12:41:48 +0000 (13:41 +0100)
File *fp, opened but not closed, this patch add fclose(fp)

Fixes: ef4b04f87fa6 ("crypto/ccp: support device init")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Ravi Kumar <ravi1.kumar@amd.com>
drivers/crypto/ccp/ccp_pci.c

index 59152ca..1702a09 100644 (file)
@@ -31,12 +31,15 @@ ccp_check_pci_uio_module(void)
        while (uio_module_names[i] != NULL) {
                while (fgets(buf, sizeof(buf), fp) != NULL) {
                        if (!strncmp(buf, uio_module_names[i],
-                                    strlen(uio_module_names[i])))
+                                    strlen(uio_module_names[i]))) {
+                               fclose(fp);
                                return i;
+                       }
                }
                i++;
                rewind(fp);
        }
+       fclose(fp);
        printf("Insert igb_uio or uio_pci_generic kernel module(s)");
        return -1;/* uio not inserted */
 }