diff options
author | Jeremy Allison <jra@samba.org> | 2004-12-09 21:42:00 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:53:34 -0500 |
commit | 0a7d17bc9b178628da371e627014412e9bef5d42 (patch) | |
tree | 62d67dc28ec049b05d146490462a2132139de282 /source | |
parent | 596f23051363f8cc8896119b3eca0663a61a38c3 (diff) | |
download | samba-0a7d17bc9b178628da371e627014412e9bef5d42.tar.gz samba-0a7d17bc9b178628da371e627014412e9bef5d42.tar.xz samba-0a7d17bc9b178628da371e627014412e9bef5d42.zip |
r4120: Never, ever, doubt valgrind :-). Fix order of evaluation bug that's been in the
bitmap code for ever. Remove silly extra space in paranoid malloc.
Jeremy.
Diffstat (limited to 'source')
-rw-r--r-- | source/lib/bitmap.c | 6 | ||||
-rw-r--r-- | source/lib/util.c | 12 |
2 files changed, 6 insertions, 12 deletions
diff --git a/source/lib/bitmap.c b/source/lib/bitmap.c index a6b52efe096..f2442d2add4 100644 --- a/source/lib/bitmap.c +++ b/source/lib/bitmap.c @@ -41,7 +41,7 @@ struct bitmap *bitmap_allocate(int n) return NULL; } - memset(bm->b, 0, sizeof(bm->b[0])*(n+31)/32); + memset(bm->b, 0, sizeof(uint32)*((n+31)/32)); return bm; } @@ -78,7 +78,7 @@ struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n) return NULL; } - memset(bm->b, 0, sizeof(bm->b[0])*(n+31)/32); + memset(bm->b, 0, sizeof(uint32)*((n+31)/32)); return bm; } @@ -92,7 +92,7 @@ int bitmap_copy(struct bitmap * const dst, const struct bitmap * const src) int count = MIN(dst->n, src->n); SMB_ASSERT(dst->b != src->b); - memcpy(dst->b, src->b, sizeof(dst->b[0])*(count+31)/32); + memcpy(dst->b, src->b, sizeof(uint32)*((count+31)/32)); return count; } diff --git a/source/lib/util.c b/source/lib/util.c index ce8495e82ed..4d66ed96558 100644 --- a/source/lib/util.c +++ b/source/lib/util.c @@ -867,9 +867,7 @@ BOOL yesno(char *p) void *malloc_(size_t size) { #undef malloc - /* If we don't add an amount here the glibc memset seems to write - one byte over. */ - return malloc(size+16); + return malloc(size); #define malloc(s) __ERROR_DONT_USE_MALLOC_DIRECTLY } @@ -880,9 +878,7 @@ void *malloc_(size_t size) static void *calloc_(size_t count, size_t size) { #undef calloc - /* If we don't add an amount here the glibc memset seems to write - one byte over. */ - return calloc(count+1, size); + return calloc(count, size); #define calloc(n,s) __ERROR_DONT_USE_CALLOC_DIRECTLY } @@ -893,9 +889,7 @@ static void *calloc_(size_t count, size_t size) static void *realloc_(void *ptr, size_t size) { #undef realloc - /* If we don't add an amount here the glibc memset seems to write - one byte over. */ - return realloc(ptr, size+16); + return realloc(ptr, size); #define realloc(p,s) __ERROR_DONT_USE_RELLOC_DIRECTLY } |