Commit 4d458690 authored by Nikias Bassen's avatar Nikias Bassen

Add plist_to_bin_free() and plist_to_xml_free() functions that free memory...

Add plist_to_bin_free() and plist_to_xml_free() functions that free memory allocated by plist_to_bin()/plist_to_xml()
parent b7c802f1
...@@ -619,6 +619,13 @@ extern "C" ...@@ -619,6 +619,13 @@ extern "C"
*/ */
void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length); void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length);
/**
* Frees the memory allocated by plist_to_xml().
*
* @param plist_xml The buffer allocated by plist_to_xml().
*/
void plist_to_xml_free(char *plist_xml);
/** /**
* Export the #plist_t structure to binary format. * Export the #plist_t structure to binary format.
* *
...@@ -629,6 +636,13 @@ extern "C" ...@@ -629,6 +636,13 @@ extern "C"
*/ */
void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length); void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length);
/**
* Frees the memory allocated by plist_to_bin().
*
* @param plist_bin The buffer allocated by plist_to_bin().
*/
void plist_to_bin_free(char *plist_bin);
/** /**
* Import the #plist_t structure from XML format. * Import the #plist_t structure from XML format.
* *
......
...@@ -1379,3 +1379,8 @@ PLIST_API void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length) ...@@ -1379,3 +1379,8 @@ PLIST_API void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length)
bplist_buff->data = NULL; // make sure we don't free the output buffer bplist_buff->data = NULL; // make sure we don't free the output buffer
byte_array_free(bplist_buff); byte_array_free(bplist_buff);
} }
PLIST_API void plist_to_bin_free(char *plist_bin)
{
free(plist_bin);
}
...@@ -531,6 +531,11 @@ PLIST_API void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length) ...@@ -531,6 +531,11 @@ PLIST_API void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length)
str_buf_free(outbuf); str_buf_free(outbuf);
} }
PLIST_API void plist_to_xml_free(char *plist_xml)
{
free(plist_xml);
}
struct _parse_ctx { struct _parse_ctx {
const char *pos; const char *pos;
const char *end; const char *end;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment