diff options
author | Joseph Sutton <josephsutton@catalyst.net.nz> | 2023-01-10 13:06:16 +1300 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2023-01-10 20:22:32 +0000 |
commit | 01bd234f6af37641017a00da0dec729928ad3060 (patch) | |
tree | db0033326a810ddd5ad2bd8cfb15eaac8e4b8a9a /lib/talloc | |
parent | 8ee203467455da0b9f774acbcc44e9b58570d811 (diff) | |
download | samba-01bd234f6af37641017a00da0dec729928ad3060.tar.gz |
lib/talloc: Zero-initialise chunk pointers
Ensuring pointers are always initialised avoids compilation errors with
FORTIFY_SOURCE=2.
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'lib/talloc')
-rw-r--r-- | lib/talloc/talloc.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c index 0189fa03be0..41fa45bc99b 100644 --- a/lib/talloc/talloc.c +++ b/lib/talloc/talloc.c @@ -831,7 +831,7 @@ static inline void *__talloc(const void *context, static inline void *_talloc_pool(const void *context, size_t size) { - struct talloc_chunk *tc; + struct talloc_chunk *tc = NULL; struct talloc_pool_hdr *pool_hdr; void *result; @@ -977,7 +977,7 @@ static inline void _tc_set_name_const(struct talloc_chunk *tc, static inline void *_talloc_named_const(const void *context, size_t size, const char *name) { void *ptr; - struct talloc_chunk *tc; + struct talloc_chunk *tc = NULL; ptr = __talloc(context, size, &tc); if (unlikely(ptr == NULL)) { @@ -1537,7 +1537,7 @@ _PUBLIC_ void *talloc_named(const void *context, size_t size, const char *fmt, . va_list ap; void *ptr; const char *name; - struct talloc_chunk *tc; + struct talloc_chunk *tc = NULL; ptr = __talloc(context, size, &tc); if (unlikely(ptr == NULL)) return NULL; @@ -1633,7 +1633,7 @@ _PUBLIC_ void *talloc_init(const char *fmt, ...) va_list ap; void *ptr; const char *name; - struct talloc_chunk *tc; + struct talloc_chunk *tc = NULL; ptr = __talloc(NULL, 0, &tc); if (unlikely(ptr == NULL)) return NULL; @@ -2449,7 +2449,7 @@ _PUBLIC_ void *_talloc_memdup(const void *t, const void *p, size_t size, const c static inline char *__talloc_strlendup(const void *t, const char *p, size_t len) { char *ret; - struct talloc_chunk *tc; + struct talloc_chunk *tc = NULL; ret = (char *)__talloc(t, len + 1, &tc); if (unlikely(!ret)) return NULL; @@ -2595,7 +2595,7 @@ static struct talloc_chunk *_vasprintf_tc(const void *t, size_t len; char *ret; va_list ap2; - struct talloc_chunk *tc; + struct talloc_chunk *tc = NULL; char buf[1024]; /* this call looks strange, but it makes it work on older solaris boxes */ |