summaryrefslogtreecommitdiff
path: root/src/sdpd-database.c
diff options
context:
space:
mode:
authorVikrampal Yadav <vikram.pal@samsung.com>2014-06-16 16:16:47 +0530
committerJohan Hedberg <johan.hedberg@intel.com>2014-06-16 16:09:12 +0300
commit20e74fef8785156cc8ac8b2415f218c1905fe4fa (patch)
tree7143a43de2dfeb2e468c65ba1700927cd10ee92d /src/sdpd-database.c
parent5f7c9ffd76887b0473d66443ac6b3a2454ba2887 (diff)
downloadbluez-20e74fef8785156cc8ac8b2415f218c1905fe4fa.tar.gz
sdp: Fix memory issues to avoid potential crash
NULL pointer check added to handle memory allocation failure scenarios.
Diffstat (limited to 'src/sdpd-database.c')
-rw-r--r--src/sdpd-database.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/sdpd-database.c b/src/sdpd-database.c
index f65a5268d..6f5577b4a 100644
--- a/src/sdpd-database.c
+++ b/src/sdpd-database.c
@@ -157,6 +157,12 @@ static int compare_indices(const void *i1, const void *i2)
void sdp_svcdb_set_collectable(sdp_record_t *record, int sock)
{
sdp_indexed_t *item = malloc(sizeof(sdp_indexed_t));
+
+ if (!item) {
+ SDPDBG("No memory");
+ return;
+ }
+
item->sock = sock;
item->record = record;
socket_index = sdp_list_insert_sorted(socket_index, item, compare_indices);