uint32_t length)
{
sdp_data_t *seq;
- sdp_data_t *d = malloc(sizeof(sdp_data_t));
+ sdp_data_t *d = bt_malloc0(sizeof(sdp_data_t));
if (!d)
return NULL;
- memset(d, 0, sizeof(sdp_data_t));
d->dtd = dtd;
d->unitSize = sizeof(uint8_t);
memset(buf, 0, sizeof(sdp_buf_t));
sdp_list_foreach(rec->attrlist, sdp_attr_size, buf);
- buf->data = malloc(buf->buf_size);
+ buf->data = bt_malloc0(buf->buf_size);
if (!buf->data)
return -ENOMEM;
buf->data_size = 0;
- memset(buf->data, 0, buf->buf_size);
sdp_list_foreach(rec->attrlist, sdp_attr_pdu, buf);
return NULL;
}
- d = malloc(sizeof(sdp_data_t));
+ d = bt_malloc0(sizeof(sdp_data_t));
if (!d)
return NULL;
SDPDBG("Extracting integer");
- memset(d, 0, sizeof(sdp_data_t));
d->dtd = *(uint8_t *) p;
p += sizeof(uint8_t);
*len += sizeof(uint8_t);
static sdp_data_t *extract_uuid(const uint8_t *p, int bufsize, int *len,
sdp_record_t *rec)
{
- sdp_data_t *d = malloc(sizeof(sdp_data_t));
+ sdp_data_t *d = bt_malloc0(sizeof(sdp_data_t));
if (!d)
return NULL;
SDPDBG("Extracting UUID");
- memset(d, 0, sizeof(sdp_data_t));
if (sdp_uuid_extract(p, bufsize, &d->val.uuid, len) < 0) {
free(d);
return NULL;
return NULL;
}
- d = malloc(sizeof(sdp_data_t));
+ d = bt_malloc0(sizeof(sdp_data_t));
if (!d)
return NULL;
- memset(d, 0, sizeof(sdp_data_t));
d->dtd = *(uint8_t *) p;
p += sizeof(uint8_t);
*len += sizeof(uint8_t);
return NULL;
}
- s = malloc(n + 1);
+ s = bt_malloc0(n + 1);
if (!s) {
SDPERR("Not enough memory for incoming string");
free(d);
return NULL;
}
- memset(s, 0, n + 1);
memcpy(s, p, n);
*len += n;
{
int seqlen, n = 0;
sdp_data_t *curr, *prev;
- sdp_data_t *d = malloc(sizeof(sdp_data_t));
+ sdp_data_t *d = bt_malloc0(sizeof(sdp_data_t));
if (!d)
return NULL;
SDPDBG("Extracting SEQ");
- memset(d, 0, sizeof(sdp_data_t));
*len = sdp_extract_seqtype(p, bufsize, &d->dtd, &seqlen);
SDPDBG("Sequence Type : 0x%x length : 0x%x", d->dtd, seqlen);
uuid_t *sdp_uuid_to_uuid128(const uuid_t *uuid)
{
- uuid_t *uuid128 = bt_malloc(sizeof(uuid_t));
+ uuid_t *uuid128 = bt_malloc0(sizeof(uuid_t));
if (!uuid128)
return NULL;
- memset(uuid128, 0, sizeof(uuid_t));
switch (uuid->type) {
case SDP_UUID128:
*uuid128 = *uuid;
sdp_record_t *sdp_record_alloc(void)
{
- sdp_record_t *rec = malloc(sizeof(sdp_record_t));
+ sdp_record_t *rec = bt_malloc0(sizeof(sdp_record_t));
if (!rec)
return NULL;
- memset(rec, 0, sizeof(sdp_record_t));
rec->handle = 0xffffffff;
return rec;
}
sdp_session_t *session;
struct sdp_transaction *t;
- session = malloc(sizeof(sdp_session_t));
+ session = bt_malloc0(sizeof(sdp_session_t));
if (!session) {
errno = ENOMEM;
return NULL;
}
- memset(session, 0, sizeof(*session));
session->flags = flags;
session->sock = sk;
- t = malloc(sizeof(struct sdp_transaction));
+ t = bt_malloc0(sizeof(struct sdp_transaction));
if (!t) {
errno = ENOMEM;
free(session);
return NULL;
}
- memset(t, 0, sizeof(*t));
session->priv = t;
return -1;
}
- rspbuf = malloc(SDP_RSP_BUFFER_SIZE);
+ rspbuf = bt_malloc0(SDP_RSP_BUFFER_SIZE);
if (!rspbuf) {
SDPERR("Response buffer alloc failure:%m (%d)", errno);
return -1;
}
- memset(rspbuf, 0, SDP_RSP_BUFFER_SIZE);
t = session->priv;
reqhdr = (sdp_pdu_hdr_t *)t->reqbuf;