summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2014-12-09 14:53:17 +0100
committerGravatar Martin Szulecki2014-12-09 14:53:17 +0100
commit5dd1bfe59ff4e396d61447946a0b8b1f28a65327 (patch)
tree43e03d72fe5ca2a94ab1d9295ba20d0c3adce437
parente5795ac9abdecac6af43ef3c1e8bf636e8a70c13 (diff)
downloadlibimobiledevice-5dd1bfe59ff4e396d61447946a0b8b1f28a65327.tar.gz
libimobiledevice-5dd1bfe59ff4e396d61447946a0b8b1f28a65327.tar.bz2
idevicedebug: Fix memory leak and compiler warnings regarding command creation
-rw-r--r--tools/idevicedebug.c8
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[])
372 372
373 /* set maximum packet size */ 373 /* set maximum packet size */
374 debug_info("Setting maximum packet size..."); 374 debug_info("Setting maximum packet size...");
375 const char* packet_size[2] = {"1024", NULL}; 375 char* packet_size[2] = {strdup("1024"), NULL};
376 debugserver_command_new("QSetMaxPacketSize:", 1, packet_size, &command); 376 debugserver_command_new("QSetMaxPacketSize:", 1, packet_size, &command);
377 free(packet_size[0]);
377 dres = debugserver_client_send_command(debugserver_client, command, &response); 378 dres = debugserver_client_send_command(debugserver_client, command, &response);
378 debugserver_command_free(command); 379 debugserver_command_free(command);
379 command = NULL; 380 command = NULL;
@@ -388,7 +389,7 @@ int main(int argc, char *argv[])
388 389
389 /* set working directory */ 390 /* set working directory */
390 debug_info("Setting working directory..."); 391 debug_info("Setting working directory...");
391 const char* working_dir[2] = {working_directory, NULL}; 392 char* working_dir[2] = {working_directory, NULL};
392 debugserver_command_new("QSetWorkingDir:", 1, working_dir, &command); 393 debugserver_command_new("QSetWorkingDir:", 1, working_dir, &command);
393 dres = debugserver_client_send_command(debugserver_client, command, &response); 394 dres = debugserver_client_send_command(debugserver_client, command, &response);
394 debugserver_command_free(command); 395 debugserver_command_free(command);
@@ -509,6 +510,9 @@ cleanup:
509 free(environment); 510 free(environment);
510 } 511 }
511 512
513 if (working_directory)
514 free(working_directory);
515
512 if (path) 516 if (path)
513 free(path); 517 free(path);
514 518