diff options
author | Szymon Janc <szymon.janc@gmail.com> | 2014-04-02 21:07:18 +0200 |
---|---|---|
committer | Szymon Janc <szymon.janc@gmail.com> | 2014-04-03 21:54:48 +0200 |
commit | 375850c4f2b50e35efe6d37d06518dcfbcece0b3 (patch) | |
tree | 3805858efe750e1626953b67e284321316127323 /android/hal-audio.c | |
parent | d5923e0ac15ee74ccb11586f369c4eb93de2f361 (diff) | |
download | bluez-375850c4f2b50e35efe6d37d06518dcfbcece0b3.tar.gz |
android/hal-audio: Fix possible NULL pointer dereference
strdup may return NULL on allocation error. Check for that.
Diffstat (limited to 'android/hal-audio.c')
-rw-r--r-- | android/hal-audio.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/android/hal-audio.c b/android/hal-audio.c index 00dde49f2..cd2c0a439 100644 --- a/android/hal-audio.c +++ b/android/hal-audio.c @@ -1161,6 +1161,9 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs) DBG("%s", kvpairs); str = strdup(kvpairs); + if (!str) + return -ENOMEM; + kvpair = strtok_r(str, ";", &saveptr); for (; kvpair && *kvpair; kvpair = strtok_r(NULL, ";", &saveptr)) { |