summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-12-23 03:50:21 +0100
committerMarcel Holtmann <marcel@holtmann.org>2008-12-23 03:50:21 +0100
commit28cfb82c67c413cddff779a875cc7a40931b46a5 (patch)
tree574a90cdd6b6d42a6da68de84ad16517805e6ee4
parent66dcd1342d3f9bf08dfc476df121c7355c84427a (diff)
Declare variable before usage
-rw-r--r--lib/sdp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/sdp.c b/lib/sdp.c
index 22058bd2..83ad4e2c 100644
--- a/lib/sdp.c
+++ b/lib/sdp.c
@@ -3060,11 +3060,14 @@ static void extract_record_handle_seq(uint8_t *pdu, int bufsize, sdp_list_t **se
int n;
for (n = 0; n < count; n++) {
+ uint32_t *pSvcRec;
if (bufsize < sizeof(uint32_t)) {
SDPERR("Unexpected end of packet");
break;
}
- uint32_t *pSvcRec = malloc(sizeof(uint32_t));
+ pSvcRec = malloc(sizeof(uint32_t));
+ if (!pSvcRec)
+ break;
*pSvcRec = ntohl(bt_get_unaligned((uint32_t *) pdata));
pSeq = sdp_list_append(pSeq, pSvcRec);
pdata += sizeof(uint32_t);