aboutsummaryrefslogtreecommitdiff
path: root/scripts/coverity-model.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2015-03-12 12:24:26 +0100
committerMarkus Armbruster <armbru@redhat.com>2015-03-17 09:29:39 +0100
commit906b8bab8bbc588f19752ed19e0222330dce31f9 (patch)
tree6a4853daa82f490c1815e6dea843bc8e3d5c960d /scripts/coverity-model.c
parent17b11a1406fdc43b5022f32a6fbfcb005a353b38 (diff)
coverity: Fix g_malloc_n-like models
Allocate the calculated overall size, not only the size of a single element. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Diffstat (limited to 'scripts/coverity-model.c')
-rw-r--r--scripts/coverity-model.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/coverity-model.c b/scripts/coverity-model.c
index 58356afa66..cdda2591d9 100644
--- a/scripts/coverity-model.c
+++ b/scripts/coverity-model.c
@@ -123,7 +123,7 @@ void *g_malloc_n(size_t nmemb, size_t size)
__coverity_negative_sink__(nmemb);
__coverity_negative_sink__(size);
sz = nmemb * size;
- ptr = __coverity_alloc__(size);
+ ptr = __coverity_alloc__(sz);
__coverity_mark_as_uninitialized_buffer__(ptr);
__coverity_mark_as_afm_allocated__(ptr, "g_free");
return ptr;
@@ -137,7 +137,7 @@ void *g_malloc0_n(size_t nmemb, size_t size)
__coverity_negative_sink__(nmemb);
__coverity_negative_sink__(size);
sz = nmemb * size;
- ptr = __coverity_alloc__(size);
+ ptr = __coverity_alloc__(sz);
__coverity_writeall0__(ptr);
__coverity_mark_as_afm_allocated__(ptr, "g_free");
return ptr;
@@ -151,7 +151,7 @@ void *g_realloc_n(void *ptr, size_t nmemb, size_t size)
__coverity_negative_sink__(size);
sz = nmemb * size;
__coverity_escape__(ptr);
- ptr = __coverity_alloc__(size);
+ ptr = __coverity_alloc__(sz);
/*
* Memory beyond the old size isn't actually initialized. Can't
* model that. See Coverity's realloc() model