Skip to content

Commit 77550bb

Browse files
committed
Improved memory cleanup in network
1 parent c67428b commit 77550bb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/cloudsync.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
extern "C" {
2121
#endif
2222

23-
#define CLOUDSYNC_VERSION "0.8.59"
23+
#define CLOUDSYNC_VERSION "0.8.60"
2424

2525
int sqlite3_cloudsync_init (sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi);
2626

src/network.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,6 @@ int network_set_sqlite_result (sqlite3_context *context, NETWORK_RESULT *result)
321321
break;
322322
}
323323

324-
network_result_cleanup(result);
325324
return rc;
326325
}
327326

@@ -339,10 +338,10 @@ int network_download_changes (sqlite3_context *context, const char *download_url
339338
int rc = SQLITE_OK;
340339
if (result.code == CLOUDSYNC_NETWORK_BUFFER) {
341340
rc = cloudsync_payload_apply(context, result.buffer, (int)result.blen);
342-
network_result_cleanup(&result);
343341
} else {
344342
rc = network_set_sqlite_result(context, &result);
345343
}
344+
network_result_cleanup(&result);
346345

347346
return rc;
348347
}
@@ -552,7 +551,6 @@ bool network_compute_endpoints (sqlite3_context *context, network_data *data, co
552551
void network_result_to_sqlite_error (sqlite3_context *context, NETWORK_RESULT res, const char *default_error_message) {
553552
sqlite3_result_error(context, ((res.code == CLOUDSYNC_NETWORK_ERROR) && (res.buffer)) ? res.buffer : default_error_message, -1);
554553
sqlite3_result_error_code(context, SQLITE_ERROR);
555-
network_result_cleanup(&res);
556554
}
557555

558556
// MARK: - Init / Cleanup -
@@ -707,6 +705,7 @@ int cloudsync_network_send_changes_internal (sqlite3_context *context, int argc,
707705
if (res.code != CLOUDSYNC_NETWORK_BUFFER) {
708706
cloudsync_memory_free(blob);
709707
network_result_to_sqlite_error(context, res, "cloudsync_network_send_changes unable to receive upload URL");
708+
network_result_cleanup(&res);
710709
return SQLITE_ERROR;
711710
}
712711

@@ -780,6 +779,7 @@ int cloudsync_network_check_internal(sqlite3_context *context) {
780779
rc = network_set_sqlite_result(context, &result);
781780
}
782781

782+
network_result_cleanup(&result);
783783
return rc;
784784
}
785785

0 commit comments

Comments
 (0)