diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2023-01-13 13:15:21 -0800 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2023-01-13 13:15:21 -0800 |
commit | 6f8b3544b95e21c46521ba071d16fb4ac10ae5d8 (patch) | |
tree | 67ce9297792591d7a44c0b9e59f0be3356506672 /src/shared | |
parent | c18e3bf92e048e44cbeb36846fe26a300dcc6be6 (diff) | |
download | bluez-6f8b3544b95e21c46521ba071d16fb4ac10ae5d8.tar.gz |
shared/bap: Fix scan-build warning
This fixes the following warning:
src/shared/bap.c:2268:26: warning: Access to field 'iov_len' results in
a dereference of a null pointer (loaded from variable 'cont')
return iov_append(data, cont->iov_len, cont->iov_base);
^~~~~~~~~~~~~
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/bap.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/shared/bap.c b/src/shared/bap.c index 0cafb75e6..88697988e 100644 --- a/src/shared/bap.c +++ b/src/shared/bap.c @@ -2261,6 +2261,12 @@ static void *ltv_merge(struct iovec *data, struct iovec *cont) { uint8_t delimiter = 0; + if (!data) + return NULL; + + if (!cont || !cont->iov_len || !cont->iov_base) + return data->iov_base; + iov_append(data, sizeof(delimiter), &delimiter); return iov_append(data, cont->iov_len, cont->iov_base); |