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) <noreply@anthropic.com>
This commit is contained in:
tr4m0ryp 2026-04-05 03:51:46 +02:00
parent 5e582f8fdf
commit af8db9836f
3 changed files with 3 additions and 3 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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;
}