1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

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>
This commit is contained in:
Joseph Sutton 2023-01-10 13:06:16 +13:00 committed by Jeremy Allison
parent 8ee2034674
commit 01bd234f6a

View File

@ -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 */