aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmdsserver/mds-message.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libmdsserver/mds-message.c')
-rw-r--r--src/libmdsserver/mds-message.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/libmdsserver/mds-message.c b/src/libmdsserver/mds-message.c
index 68334de..5007f23 100644
--- a/src/libmdsserver/mds-message.c
+++ b/src/libmdsserver/mds-message.c
@@ -82,14 +82,12 @@ void mds_message_zero_initialise(mds_message_t* restrict this)
*/
void mds_message_destroy(mds_message_t* restrict this)
{
+ size_t i;
if (this->headers != NULL)
- {
- size_t i;
- xfree(this->headers, this->header_count);
- }
+ xfree(this->headers, this->header_count);
- free(this->payload);
- free(this->buffer);
+ free(this->payload), this->payload = NULL;
+ free(this->buffer), this->buffer = NULL;
}
@@ -136,12 +134,9 @@ static int mds_message_extend_buffer(mds_message_t* restrict this)
*/
static void reset_message(mds_message_t* restrict this)
{
+ size_t i;
if (this->headers != NULL)
- {
- size_t i;
- xfree(this->headers, this->header_count);
- this->headers = NULL;
- }
+ xfree(this->headers, this->header_count);
this->header_count = 0;
free(this->payload);