diff options
-rw-r--r-- | include/libimobiledevice/debugserver.h | 2 | ||||
-rw-r--r-- | src/debugserver.c | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/include/libimobiledevice/debugserver.h b/include/libimobiledevice/debugserver.h index 3b1969a..3626182 100644 --- a/include/libimobiledevice/debugserver.h +++ b/include/libimobiledevice/debugserver.h @@ -195,7 +195,7 @@ debugserver_error_t debugserver_client_set_environment_hex_encoded(debugserver_c * @return DEBUGSERVER_E_SUCCESS on success, * DEBUGSERVER_E_INVALID_ARG when name or command is NULL */ -debugserver_error_t debugserver_command_new(const char* name, int argc, const char* argv[], debugserver_command_t* command); +debugserver_error_t debugserver_command_new(const char* name, int argc, char* argv[], debugserver_command_t* command); /** * Frees memory of command object. diff --git a/src/debugserver.c b/src/debugserver.c index 37b54de..e653a8e 100644 --- a/src/debugserver.c +++ b/src/debugserver.c @@ -153,7 +153,7 @@ LIBIMOBILEDEVICE_API debugserver_error_t debugserver_client_receive(debugserver_ return debugserver_client_receive_with_timeout(client, data, size, received, 1000); } -LIBIMOBILEDEVICE_API debugserver_error_t debugserver_command_new(const char* name, int argc, const char* argv[], debugserver_command_t* command) +LIBIMOBILEDEVICE_API debugserver_error_t debugserver_command_new(const char* name, int argc, char* argv[], debugserver_command_t* command) { int i; debugserver_command_t tmp = (debugserver_command_t) malloc(sizeof(struct debugserver_command_private)); @@ -541,13 +541,16 @@ LIBIMOBILEDEVICE_API debugserver_error_t debugserver_client_set_environment_hex_ return DEBUGSERVER_E_INVALID_ARG; debugserver_error_t result = DEBUGSERVER_E_UNKNOWN_ERROR; - const char* env_arg[] = { env, NULL }; + char* env_tmp = strdup(env); + char* env_arg[2] = { env_tmp, NULL }; debugserver_command_t command = NULL; debugserver_command_new("QEnvironmentHexEncoded:", 1, env_arg, &command); result = debugserver_client_send_command(client, command, response); debugserver_command_free(command); + free(env_tmp); + return result; } |