[gvdb/fix-scan-build-findings] Fix scan-build findings
- From: Jan-Michael Brummer <jbrummer src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvdb/fix-scan-build-findings] Fix scan-build findings
- Date: Fri, 8 Jan 2021 19:44:24 +0000 (UTC)
commit 95507fe72cb55f1ee39359647936d86458deb6e4
Author: Jan-Michael Brummer <jan brummer tabos org>
Date: Fri Jan 8 20:44:07 2021 +0100
Fix scan-build findings
gvdb-builder.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/gvdb-builder.c b/gvdb-builder.c
index 918ee43..cbd01c4 100644
--- a/gvdb-builder.c
+++ b/gvdb-builder.c
@@ -327,6 +327,8 @@ file_builder_allocate_for_hash (FileBuilder *fb,
n_items * sizeof (struct gvdb_hash_item);
data = file_builder_allocate (fb, 4, size, pointer);
+ if (!data)
+ return;
#define chunk(s) (size -= (s), data += (s), data - (s))
memcpy (chunk (sizeof bloom_hdr), &bloom_hdr, sizeof bloom_hdr);
@@ -355,7 +357,7 @@ file_builder_add_hash (FileBuilder *fb,
GHashTable *table,
struct gvdb_pointer *pointer)
{
- guint32_le *buckets, *bloom_filter;
+ guint32_le *buckets = NULL, *bloom_filter;
struct gvdb_hash_item *items;
HashTable *mytable;
GvdbItem *item;
@@ -373,6 +375,9 @@ file_builder_add_hash (FileBuilder *fb,
file_builder_allocate_for_hash (fb, mytable->n_buckets, index, 5, 0,
&bloom_filter, &buckets, &items, pointer);
+ if (!buckets)
+ return;
+
index = 0;
for (bucket = 0; bucket < mytable->n_buckets; bucket++)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]