From 28cfb82c67c413cddff779a875cc7a40931b46a5 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 23 Dec 2008 03:50:21 +0100 Subject: Declare variable before usage --- lib/sdp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') 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); -- cgit