diff options
author | Anupam Roy <anupam.r@samsung.com> | 2015-07-21 09:38:01 -0400 |
---|---|---|
committer | Szymon Janc <szymon.janc@tieto.com> | 2015-07-27 21:12:11 +0200 |
commit | 360ecd96fed73867e7b96ab06a6f8ac390ec814a (patch) | |
tree | ea188d4decf15375ce91bcf570c77f37e68bf5fa /android | |
parent | 581edd089595a3a06d4c0dae78af6b0d2a4dc4af (diff) | |
download | bluez-360ecd96fed73867e7b96ab06a6f8ac390ec814a.tar.gz |
android/client: Handle failure from malloc() request
In case malloc() request fails, just print error message
and return. Dereferencing reg.mdep_cfg in case of failure
can lead to crash.
Diffstat (limited to 'android')
-rw-r--r-- | android/client/if-hl.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/android/client/if-hl.c b/android/client/if-hl.c index e0818ba1a..bd0567111 100644 --- a/android/client/if-hl.c +++ b/android/client/if-hl.c @@ -201,6 +201,10 @@ static void register_application_p(int argc, const char **argv) reg.number_of_mdeps = atoi(argv[6]); reg.mdep_cfg = malloc(reg.number_of_mdeps * sizeof(bthl_mdep_cfg_t)); + if (!reg.mdep_cfg) { + haltest_error("malloc failed\n"); + return; + } mdep_argc_init = 7; for (i = 0; i < reg.number_of_mdeps; i++) { |