summaryrefslogtreecommitdiff
path: root/bitmap.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2017-10-04 11:23:58 +0100
committerColin Watson <cjwatson@debian.org>2017-10-05 23:58:12 +0100
commit0556ea972b15607b7e13ff31bc05840881c91dd3 (patch)
treed6b8d48062d0278b5ae0eeff42d0e9afa9f26860 /bitmap.c
parentdb2122d97eb1ecdd8d99b7bf79b0dd2b5addfd92 (diff)
parent801a62eedaaf47b20dbf4b426dc3e084bf0c8d49 (diff)
New upstream release (7.6p1)
Diffstat (limited to 'bitmap.c')
-rw-r--r--bitmap.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/bitmap.c b/bitmap.c
index f95032250..5089b0407 100644
--- a/bitmap.c
+++ b/bitmap.c
@@ -53,8 +53,9 @@ void
53bitmap_free(struct bitmap *b) 53bitmap_free(struct bitmap *b)
54{ 54{
55 if (b != NULL && b->d != NULL) { 55 if (b != NULL && b->d != NULL) {
56 explicit_bzero(b->d, b->len); 56 bitmap_zero(b);
57 free(b->d); 57 free(b->d);
58 b->d = NULL;
58 } 59 }
59 free(b); 60 free(b);
60} 61}
@@ -86,10 +87,10 @@ reserve(struct bitmap *b, u_int n)
86 return -1; /* invalid */ 87 return -1; /* invalid */
87 nlen = (n / BITMAP_BITS) + 1; 88 nlen = (n / BITMAP_BITS) + 1;
88 if (b->len < nlen) { 89 if (b->len < nlen) {
89 if ((tmp = reallocarray(b->d, nlen, BITMAP_BYTES)) == NULL) 90 if ((tmp = recallocarray(b->d, b->len,
91 nlen, BITMAP_BYTES)) == NULL)
90 return -1; 92 return -1;
91 b->d = tmp; 93 b->d = tmp;
92 memset(b->d + b->len, 0, (nlen - b->len) * BITMAP_BYTES);
93 b->len = nlen; 94 b->len = nlen;
94 } 95 }
95 return 0; 96 return 0;
@@ -188,7 +189,7 @@ bitmap_from_string(struct bitmap *b, const void *p, size_t l)
188{ 189{
189 int r; 190 int r;
190 size_t i, offset, shift; 191 size_t i, offset, shift;
191 u_char *s = (u_char *)p; 192 const u_char *s = (const u_char *)p;
192 193
193 if (l > BITMAP_MAX / 8) 194 if (l > BITMAP_MAX / 8)
194 return -1; 195 return -1;