diff --git a/src/profile.c b/src/profile.c
index 4c8f3c6..f953b84 100644
--- a/src/profile.c
+++ b/src/profile.c
static uint16_t ext_register_record(struct ext_profile *ext, bdaddr_t *src)
{
sdp_record_t *rec;
- uint16_t handle;
if (ext->record)
rec = sdp_xml_parse_record(ext->record, strlen(ext->record));
if (add_record_to_server(src, rec) < 0) {
error("Failed to register service record");
+ sdp_record_free(rec);
return 0;
}
- handle = rec->handle;
-
- sdp_record_free(rec);
-
- return handle;
+ return rec->handle;
}
static int ext_start_servers(struct ext_profile *ext,