diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2008-12-23 03:50:21 +0100 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2008-12-23 03:50:21 +0100 |
commit | 28cfb82c67c413cddff779a875cc7a40931b46a5 (patch) | |
tree | 574a90cdd6b6d42a6da68de84ad16517805e6ee4 | |
parent | 66dcd1342d3f9bf08dfc476df121c7355c84427a (diff) |
Declare variable before usage
-rw-r--r-- | lib/sdp.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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); |