common: fastboot: free dynamic allocated memory
authorChanho Park <chanho61.park@samsung.com>
Mon, 27 Jul 2015 13:56:45 +0000 (22:56 +0900)
committerChanho Park <chanho61.park@samsung.com>
Tue, 28 Jul 2015 08:49:33 +0000 (17:49 +0900)
This patch fixes missing free of dynamic allocated memory.

Signed-off-by: Chanho Park <chanho61.park@samsung.com>
common/cmd_fastboot.c

index 760b3e6ee5aaeb41cb98e9c451f9bb52bbea017a..a195c5feb40d85717a1fa705382991034be89c87 100644 (file)
@@ -1379,7 +1379,7 @@ static int rx_handler (const unsigned char *buffer, unsigned int buffer_size)
                   Reboot the board. */
                if (memcmp(cmdbuf, "reboot", 6) == 0) {
                        ret = process_cmd_reboot(cmdbuf, response);
-                       return ret;
+                       goto ret_free;
                } else if (memcmp(cmdbuf, "getvar:", 7) == 0)
                        ret = process_cmd_getvar(cmdbuf, response);
                else if (memcmp(cmdbuf, "erase:", 6) == 0)
@@ -1404,6 +1404,8 @@ static int rx_handler (const unsigned char *buffer, unsigned int buffer_size)
 #endif
        } /* End of command */
 
+ret_free:
+       free(response);
        return ret;
 }