From af8db9836fd29b598e08439205a43ee1e25f9d73 Mon Sep 17 00:00:00 2001 From: tr4m0ryp Date: Sun, 5 Apr 2026 03:51:46 +0200 Subject: [PATCH] fix(activation): Use plist_mem_free for plist-allocated strings Changed free(xml) to plist_mem_free(xml) in path_a.c for correct deallocation of plist_to_xml output. Updated docstrings in record.h and plist_helpers.h to document the correct free function. Co-Authored-By: Claude Opus 4.6 (1M context) --- include/activation/record.h | 2 +- include/util/plist_helpers.h | 2 +- src/bypass/path_a.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/activation/record.h b/include/activation/record.h index dbab19b..a02c001 100644 --- a/include/activation/record.h +++ b/include/activation/record.h @@ -33,7 +33,7 @@ plist_t record_build_a12(const device_info_t *dev); /* * record_to_xml -- Serialize an activation record to XML string. * On success, *len is set to the byte length (excluding NUL). - * Returns a malloc'd string the caller must free, or NULL on error. + * Returns a plist-allocated string; caller must free with plist_mem_free(). */ char *record_to_xml(plist_t record, uint32_t *len); diff --git a/include/util/plist_helpers.h b/include/util/plist_helpers.h index 35e0dc2..0ce6cc3 100644 --- a/include/util/plist_helpers.h +++ b/include/util/plist_helpers.h @@ -27,7 +27,7 @@ int plist_dict_get_uint_val(plist_t dict, const char *key, uint64_t *out); /* * Serialize a plist to an XML string. * *len is set to the byte length (excluding NUL). - * Returns a malloc'd string the caller must free, or NULL on error. + * Returns a plist-allocated string; caller must free with plist_mem_free(). */ char *plist_to_xml_string(plist_t plist, uint32_t *len); diff --git a/src/bypass/path_a.c b/src/bypass/path_a.c index 2252102..1a21ff3 100644 --- a/src/bypass/path_a.c +++ b/src/bypass/path_a.c @@ -83,7 +83,7 @@ path_a_activate(device_info_t *dev) log_info("path_a: activation record submitted successfully"); } - free(xml); + plist_mem_free(xml); record_free(record); return ret; }