diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/sdp-glib.c | 2 | ||||
-rw-r--r-- | common/sdp-xml.c | 18 |
2 files changed, 13 insertions, 7 deletions
diff --git a/common/sdp-glib.c b/common/sdp-glib.c index 37c8580f..a24464ce 100644 --- a/common/sdp-glib.c +++ b/common/sdp-glib.c @@ -230,6 +230,8 @@ sdp_record_t *sdp_xml_parse_record(const char *data, int size) return NULL; } + g_markup_parse_context_free(ctx); + free(ctx_data); return record; diff --git a/common/sdp-xml.c b/common/sdp-xml.c index 87200908..abebc652 100644 --- a/common/sdp-xml.c +++ b/common/sdp-xml.c @@ -676,6 +676,8 @@ static sdp_data_t *sdp_xml_parse_text_with_size(const char *data, char encoding, debug("Unit size %d length %d: -->%s<--\n", ret->unitSize, length, text); + free(text); + return ret; } #endif @@ -696,6 +698,8 @@ sdp_data_t *sdp_xml_parse_text(const char *data, char encoding) debug("Unit size %d length %d: -->%s<--\n", ret->unitSize, length, text); + free(text); + return ret; } @@ -711,18 +715,16 @@ struct sdp_xml_data *sdp_xml_data_alloc() struct sdp_xml_data *elem; elem = malloc(sizeof(struct sdp_xml_data)); + if (!elem) + return NULL; + + memset(elem, 0, sizeof(struct sdp_xml_data)); /* Null terminate the text */ elem->size = DEFAULT_XML_DATA_SIZE; elem->text = malloc(DEFAULT_XML_DATA_SIZE); elem->text[0] = '\0'; - elem->next = 0; - elem->data = 0; - - elem->type = 0; - elem->name = 0; - return elem; } @@ -734,7 +736,9 @@ void sdp_xml_data_free(struct sdp_xml_data *elem) if (elem->name) free(elem->name); - free(elem->text); + if (elem->text) + + free(elem->text); free(elem); } |