}
} else {
if (sdp_record_find(rec->handle)) {
- sdp_record_free(rec);
- goto invalid;
+ /* extract_pdu_server will add the record handle
+ * if it is missing. So instead of failing, skip
+ * the record adding to avoid duplication. */
+ goto success;
}
}
handle = sdp_data_alloc(SDP_UINT32, &rec->handle);
sdp_attr_replace(rec, SDP_ATTR_RECORD_HANDLE, handle);
- /*
- * if the browse group descriptor is NULL,
- * ensure that the record belongs to the ROOT group
- */
+success:
+ /* if the browse group descriptor is NULL,
+ * ensure that the record belongs to the ROOT group */
if (sdp_data_get(rec, SDP_ATTR_BROWSE_GRP_LIST) == NULL) {
uuid_t uuid;
sdp_uuid16_create(&uuid, PUBLIC_BROWSE_GROUP);