mirror of
https://github.com/StikDebug/StikDebug.git
synced 2026-10-15 20:10:30 +00:00
Fix memory issues
This commit is contained in:
parent
85dc937794
commit
c1f27dc1c5
1 changed files with 15 additions and 6 deletions
|
|
@ -38,6 +38,15 @@ int simulate_location(const char *device_ip,
|
|||
{
|
||||
idevice_init_logger(Debug, Disabled, NULL);
|
||||
IdeviceFfiError *err = NULL;
|
||||
|
||||
if (g_location_sim) {
|
||||
if ((err = location_simulation_set(g_location_sim, latitude, longitude))) {
|
||||
idevice_error_free(err);
|
||||
cleanup_on_error();
|
||||
} else {
|
||||
return IPA_OK;
|
||||
}
|
||||
}
|
||||
|
||||
struct sockaddr_in addr = { .sin_family = AF_INET,
|
||||
.sin_port = htons(LOCKDOWN_PORT) };
|
||||
|
|
@ -45,6 +54,11 @@ int simulate_location(const char *device_ip,
|
|||
return IPA_ERR_INVALID_IP;
|
||||
}
|
||||
|
||||
if (g_pairing) {
|
||||
idevice_pairing_file_free(g_pairing);
|
||||
g_pairing = NULL;
|
||||
}
|
||||
|
||||
if ((err = idevice_pairing_file_read(pairing_file, &g_pairing))) {
|
||||
idevice_error_free(err);
|
||||
return IPA_ERR_PAIRING_READ;
|
||||
|
|
@ -132,12 +146,7 @@ int clear_simulated_location(void)
|
|||
if (!g_location_sim) return IPA_ERR_LOCATION_CLEAR;
|
||||
|
||||
err = location_simulation_clear(g_location_sim);
|
||||
location_simulation_free(g_location_sim);
|
||||
g_location_sim = NULL;
|
||||
cleanup_on_error();
|
||||
|
||||
if (g_remote_server) { remote_server_free(g_remote_server); g_remote_server = NULL; }
|
||||
if (g_handshake) { rsd_handshake_free(g_handshake); g_handshake = NULL; }
|
||||
if (g_adapter) { adapter_free(g_adapter); g_adapter = NULL; }
|
||||
|
||||
return err ? IPA_ERR_LOCATION_CLEAR : IPA_OK;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue