OSDN Git Service

diag: Free the memory in diagfwd_peripheral_exit()
authorSreelakshmi Gownipalli <sgownipa@codeaurora.org>
Mon, 18 Sep 2017 19:41:47 +0000 (12:41 -0700)
committerGerrit - the friendly Code Review server <code-review@localhost>
Wed, 6 Dec 2017 07:36:47 +0000 (23:36 -0800)
In diagfwd_peripheral_exit() free the memory associated with
early_init_info.

Change-Id: I862b6d806d67dad38316f1608827a4bf6f5a691f
Signed-off-by: Sreelakshmi Gownipalli <sgownipa@codeaurora.org>
drivers/char/diag/diagfwd_peripheral.c

index b7dff47..7e428ce 100644 (file)
@@ -911,6 +911,7 @@ void diagfwd_peripheral_exit(void)
        uint8_t peripheral;
        uint8_t type;
        struct diagfwd_info *fwd_info = NULL;
+       int transport = 0;
 
        diag_smd_exit();
        diag_socket_exit();
@@ -933,7 +934,10 @@ void diagfwd_peripheral_exit(void)
                driver->diagfwd_dci_cmd[peripheral] = NULL;
        }
 
-       kfree(early_init_info);
+       for (transport = 0; transport < NUM_TRANSPORT; transport++) {
+               kfree(early_init_info[transport]);
+               early_init_info[transport] = NULL;
+       }
 }
 
 int diagfwd_cntl_register(uint8_t transport, uint8_t peripheral, void *ctxt,