diff options
author | Martin Szulecki | 2014-12-09 14:53:17 +0100 |
---|---|---|
committer | Martin Szulecki | 2014-12-09 14:53:17 +0100 |
commit | 5dd1bfe59ff4e396d61447946a0b8b1f28a65327 (patch) | |
tree | 43e03d72fe5ca2a94ab1d9295ba20d0c3adce437 | |
parent | e5795ac9abdecac6af43ef3c1e8bf636e8a70c13 (diff) | |
download | libimobiledevice-5dd1bfe59ff4e396d61447946a0b8b1f28a65327.tar.gz libimobiledevice-5dd1bfe59ff4e396d61447946a0b8b1f28a65327.tar.bz2 |
idevicedebug: Fix memory leak and compiler warnings regarding command creation
-rw-r--r-- | tools/idevicedebug.c | 8 |
1 files changed, 6 insertions, 2 deletions
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); |