From 5dd1bfe59ff4e396d61447946a0b8b1f28a65327 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Tue, 9 Dec 2014 14:53:17 +0100 Subject: idevicedebug: Fix memory leak and compiler warnings regarding command creation --- tools/idevicedebug.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tools/idevicedebug.c') diff --git a/tools/idevicedebug.c b/tools/idevicedebug.c index c8772ed..1d49e07 100644 --- a/tools/idevicedebug.c +++ b/tools/idevicedebug.c @@ -372,8 +372,9 @@ int main(int argc, char *argv[]) /* set maximum packet size */ debug_info("Setting maximum packet size..."); - const char* packet_size[2] = {"1024", NULL}; + char* packet_size[2] = {strdup("1024"), NULL}; debugserver_command_new("QSetMaxPacketSize:", 1, packet_size, &command); + free(packet_size[0]); dres = debugserver_client_send_command(debugserver_client, command, &response); debugserver_command_free(command); command = NULL; @@ -388,7 +389,7 @@ int main(int argc, char *argv[]) /* set working directory */ debug_info("Setting working directory..."); - const char* working_dir[2] = {working_directory, NULL}; + char* working_dir[2] = {working_directory, NULL}; debugserver_command_new("QSetWorkingDir:", 1, working_dir, &command); dres = debugserver_client_send_command(debugserver_client, command, &response); debugserver_command_free(command); @@ -509,6 +510,9 @@ cleanup: free(environment); } + if (working_directory) + free(working_directory); + if (path) free(path); -- cgit v1.1-32-gdbae