summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2008-03-10 21:57:46 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2008-03-10 21:57:46 +0000
commit1f9ec47e02cc789ab45c85e855c4f9e377df7e3c (patch)
treee3ac1bab178dea6a1ca3ce08e001f75aabe72148
parent03bac653ed513d6efaaa36eb349b5ca9a23dce19 (diff)
sdp_get_uuidseq_attr: fixed memory leak
-rw-r--r--src/sdp.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/sdp.c b/src/sdp.c
index 44ba17e4..28e24c0a 100644
--- a/src/sdp.c
+++ b/src/sdp.c
@@ -1530,13 +1530,14 @@ int sdp_get_uuidseq_attr(const sdp_record_t *rec, uint16_t attr, sdp_list_t **se
if (sdpdata && sdpdata->dtd >= SDP_SEQ8 && sdpdata->dtd <= SDP_SEQ32) {
sdp_data_t *d;
for (d = sdpdata->val.dataseq; d; d = d->next) {
- uuid_t *u = malloc(sizeof(uuid_t));
- memset((char *)u, 0, sizeof(uuid_t));
- if (d->dtd >= SDP_UUID16 && d->dtd <= SDP_UUID128) {
- *u = d->val.uuid;
- *seqp = sdp_list_append(*seqp, u);
- } else
+ uuid_t *u;
+ if (d->dtd < SDP_UUID16 || d->dtd > SDP_UUID128)
goto fail;
+
+ u = malloc(sizeof(uuid_t));
+ memset(u, 0, sizeof(uuid_t));
+ *u = d->val.uuid;
+ *seqp = sdp_list_append(*seqp, u);
}
return 0;
}