diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2006-08-23 15:05:23 +0000 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2006-08-23 15:05:23 +0000 |
commit | 1aa9e2bb9fbbdeeed3b2d5086929d0ed3bb42993 (patch) | |
tree | b4550d1328222f41ee0206bb18a9468de37f6556 /hcid/dbus-sdp.c | |
parent | 684ba3688de17a3b8a6defd3139e1b8bf8971ef5 (diff) |
Fix memory leak and coding style in rfcomm patch
Diffstat (limited to 'hcid/dbus-sdp.c')
-rw-r--r-- | hcid/dbus-sdp.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/hcid/dbus-sdp.c b/hcid/dbus-sdp.c index 2634a5ea..2a448af4 100644 --- a/hcid/dbus-sdp.c +++ b/hcid/dbus-sdp.c @@ -835,8 +835,8 @@ search_request: static int sdp_uuid_comp_func(const void *key1, const void *key2) { - const uuid_t *a = (const uuid_t *)key1; - const uuid_t *b = (const uuid_t *)key2; + const uuid_t *a = key1; + const uuid_t *b = key2; if (a->type != b->type) return 1; @@ -844,14 +844,11 @@ static int sdp_uuid_comp_func(const void *key1, const void *key2) switch (a->type) { case SDP_UUID16: return !(a->value.uuid16 == b->value.uuid16); - break; case SDP_UUID32: return !(a->value.uuid32 == b->value.uuid32); - break; case SDP_UUID128: return !memcmp(&a->value.uuid128, &b->value.uuid128, sizeof(uint128_t)); - break; } return 1; } @@ -861,8 +858,7 @@ sdp_record_t *find_record_by_uuid(const char *address, uuid_t *uuid) struct slist *lp, *lr; struct service_provider *p; struct service_record *r; - sdp_list_t *list = 0; - + sdp_list_t *list = NULL; for (lp = sdp_cache; lp; lp = lp->next) { p = lp->data; @@ -872,10 +868,10 @@ sdp_record_t *find_record_by_uuid(const char *address, uuid_t *uuid) for (lr = p->lrec; lr; lr = lr->next) { r = lr->data; /* Check whether the record has the correct uuid */ - if (sdp_get_service_classes(r->record, &list) !=0) + if (sdp_get_service_classes(r->record, &list) != 0) continue; - if (sdp_list_find (list, &uuid, sdp_uuid_comp_func)) + if (sdp_list_find(list, &uuid, sdp_uuid_comp_func)) return r->record; } } |