{"$schema": "https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/schemas/sarif-schema-2.1.0.json",
 "version": "2.1.0",
 "runs": [{"tool": {"driver": {"name": "GNU C23",
                               "fullName": "GNU C23 (GCC) version 16.1.1 20260703 (Red Hat 16.1.1-4) (x86_64-redhat-linux)",
                               "version": "16.1.1 20260703 (Red Hat 16.1.1-4)",
                               "informationUri": "https://gcc.gnu.org/gcc-16/",
                               "rules": [{"id": "-Wanalyzer-null-dereference",
                                          "helpUri": "https://gcc.gnu.org/onlinedocs/gcc-16.1.0/gcc/Static-Analyzer-Options.html#index-Wanalyzer-null-dereference"}]}},
           "taxonomies": [{"name": "CWE",
                           "version": "4.7",
                           "organization": "MITRE",
                           "shortDescription": {"text": "The MITRE Common Weakness Enumeration"},
                           "taxa": [{"id": "476",
                                     "helpUri": "https://cwe.mitre.org/data/definitions/476.html"}]}],
           "invocations": [{"arguments": ["/usr/libexec/gcc/x86_64-redhat-linux/16/cc1",
                                          "-quiet",
                                          "-I",
                                          ".",
                                          "-I",
                                          "../..",
                                          "-I",
                                          ".",
                                          "-I",
                                          "../..",
                                          "-I",
                                          "lib/replace",
                                          "-I",
                                          "../../lib/replace",
                                          "-D",
                                          "_GNU_SOURCE=1",
                                          "-D",
                                          "_XOPEN_SOURCE_EXTENDED=1",
                                          "-D",
                                          "__STDC_WANT_LIB_EXT1__=1",
                                          "-D",
                                          "STATIC_talloc_MODULES=NULL",
                                          "-D",
                                          "STATIC_talloc_MODULES_PROTO=extern void __talloc_dummy_module_proto(void)",
                                          "-D",
                                          "HAVE_PYEMBED=1",
                                          "-D",
                                          "HAVE_PYEXT=1",
                                          "-D",
                                          "HAVE_PYTHON_H=1",
                                          "../../talloc.c",
                                          "-quiet",
                                          "-dumpbase",
                                          "talloc.c",
                                          "-dumpbase-ext",
                                          ".c",
                                          "-m64",
                                          "-mtune=generic",
                                          "-march=x86-64",
                                          "-mtls-dialect=gnu2",
                                          "-O2",
                                          "-Wno-unknown-pragmas",
                                          "-flto=auto",
                                          "-ffat-lto-objects",
                                          "-fexceptions",
                                          "-fstack-protector-strong",
                                          "-fasynchronous-unwind-tables",
                                          "-fcf-protection=full",
                                          "-fno-omit-frame-pointer",
                                          "-fPIC",
                                          "-fstack-clash-protection",
                                          "-fvisibility=hidden",
                                          "-fanalyzer",
                                          "-fdiagnostics-path-format=separate-events",
                                          "-fno-diagnostics-show-caret",
                                          "-fno-lto",
                                          "-fanalyzer-assume-nothrow",
                                          "-fdiagnostics-text-art-charset=none",
                                          "-fdiagnostics-set-output=sarif:file=/builddir/gcc-results/6011-TFou.sarif",
                                          "-o",
                                          "/tmp/ccvqs0NY.s"],
                            "workingDirectory": {"uri": "/builddir/build/BUILD/libtalloc-2.4.4-build/talloc-2.4.4/bin/default"},
                            "startTimeUtc": "2026-08-03T17:57:51Z",
                            "executionSuccessful": true,
                            "toolExecutionNotifications": [],
                            "endTimeUtc": "2026-08-03T17:57:56Z"}],
           "originalUriBaseIds": {"PWD": {"uri": "file:///builddir/build/BUILD/libtalloc-2.4.4-build/talloc-2.4.4/bin/default/"}},
           "artifacts": [{"location": {"uri": "../../talloc.c",
                                       "uriBaseId": "PWD"},
                          "sourceLanguage": "c",
                          "contents": {"text": "/*\n   Samba Unix SMB/CIFS implementation.\n\n   Samba trivial allocation library - new interface\n\n   NOTE: Please read talloc_guide.txt for full documentation\n\n   Copyright (C) Andrew Tridgell 2004\n   Copyright (C) Stefan Metzmacher 2006\n\n     ** NOTE! The following LGPL license applies to the talloc\n     ** library. This does NOT imply that all of Samba is released\n     ** under the LGPL\n\n   This library is free software; you can redistribute it and/or\n   modify it under the terms of the GNU Lesser General Public\n   License as published by the Free Software Foundation; either\n   version 3 of the License, or (at your option) any later version.\n\n   This library is distributed in the hope that it will be useful,\n   but WITHOUT ANY WARRANTY; without even the implied warranty of\n   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n   Lesser General Public License for more details.\n\n   You should have received a copy of the GNU Lesser General Public\n   License along with this library; if not, see <http://www.gnu.org/licenses/>.\n*/\n\n/*\n  inspired by http://swapped.cc/halloc/\n*/\n\n#include \"replace.h\"\n#include \"talloc.h\"\n\n#ifdef HAVE_SYS_AUXV_H\n#include <sys/auxv.h>\n#endif\n\n#if (TALLOC_VERSION_MAJOR != TALLOC_BUILD_VERSION_MAJOR)\n#error \"TALLOC_VERSION_MAJOR != TALLOC_BUILD_VERSION_MAJOR\"\n#endif\n\n#if (TALLOC_VERSION_MINOR != TALLOC_BUILD_VERSION_MINOR)\n#error \"TALLOC_VERSION_MINOR != TALLOC_BUILD_VERSION_MINOR\"\n#endif\n\n/* Special macros that are no-ops except when run under Valgrind on\n * x86.  They've moved a little bit from valgrind 1.0.4 to 1.9.4 */\n#ifdef HAVE_VALGRIND_MEMCHECK_H\n        /* memcheck.h includes valgrind.h */\n#include <valgrind/memcheck.h>\n#elif defined(HAVE_VALGRIND_H)\n#include <valgrind.h>\n#endif\n\n#define MAX_TALLOC_SIZE 0x10000000\n\n#define TALLOC_FLAG_FREE 0x01\n#define TALLOC_FLAG_LOOP 0x02\n#define TALLOC_FLAG_POOL 0x04\t\t/* This is a talloc pool */\n#define TALLOC_FLAG_POOLMEM 0x08\t/* This is allocated in a pool */\n\n/*\n * Bits above this are random, used to make it harder to fake talloc\n * headers during an attack.  Try not to change this without good reason.\n */\n#define TALLOC_FLAG_MASK 0x0F\n\n#define TALLOC_MAGIC_REFERENCE ((const char *)1)\n\n#define TALLOC_MAGIC_BASE 0xe814ec70\n#define TALLOC_MAGIC_NON_RANDOM ( \\\n\t~TALLOC_FLAG_MASK & ( \\\n\t\tTALLOC_MAGIC_BASE + \\\n\t\t(TALLOC_BUILD_VERSION_MAJOR << 24) + \\\n\t\t(TALLOC_BUILD_VERSION_MINOR << 16) + \\\n\t\t(TALLOC_BUILD_VERSION_RELEASE << 8)))\nstatic unsigned int talloc_magic = TALLOC_MAGIC_NON_RANDOM;\n\n/* by default we abort when given a bad pointer (such as when talloc_free() is called\n   on a pointer that came from malloc() */\n#ifndef TALLOC_ABORT\n#define TALLOC_ABORT(reason) abort()\n#endif\n\n#ifndef discard_const_p\n#if defined(__intptr_t_defined) || defined(HAVE_INTPTR_T)\n# define discard_const_p(type, ptr) ((type *)((intptr_t)(ptr)))\n#else\n# define discard_const_p(type, ptr) ((type *)(ptr))\n#endif\n#endif\n\n/* these macros gain us a few percent of speed on gcc */\n#if (__GNUC__ >= 3)\n/* the strange !! is to ensure that __builtin_expect() takes either 0 or 1\n   as its first argument */\n#ifndef likely\n#define likely(x)   __builtin_expect(!!(x), 1)\n#endif\n#ifndef unlikely\n#define unlikely(x) __builtin_expect(!!(x), 0)\n#endif\n#else\n#ifndef likely\n#define likely(x) (x)\n#endif\n#ifndef unlikely\n#define unlikely(x) (x)\n#endif\n#endif\n\n/* this null_context is only used if talloc_enable_leak_report() or\n   talloc_enable_leak_report_full() is called, otherwise it remains\n   NULL\n*/\nstatic void *null_context;\nstatic bool talloc_report_null;\nstatic bool talloc_report_null_full;\nstatic void *autofree_context;\n\nstatic void talloc_setup_atexit(void);\n\n/* used to enable fill of memory on free, which can be useful for\n * catching use after free errors when valgrind is too slow\n */\nstatic struct {\n\tbool initialised;\n\tbool enabled;\n\tuint8_t fill_value;\n} talloc_fill;\n\n#define TALLOC_FILL_ENV \"TALLOC_FREE_FILL\"\n\n/*\n * do not wipe the header, to allow the\n * double-free logic to still work\n */\n#define TC_INVALIDATE_FULL_FILL_CHUNK(_tc) do { \\\n\tif (unlikely(talloc_fill.enabled)) { \\\n\t\tsize_t _flen = (_tc)->size; \\\n\t\tchar *_fptr = (char *)TC_PTR_FROM_CHUNK(_tc); \\\n\t\tmemset(_fptr, talloc_fill.fill_value, _flen); \\\n\t} \\\n} while (0)\n\n#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_NOACCESS)\n/* Mark the whole chunk as not accessible */\n#define TC_INVALIDATE_FULL_VALGRIND_CHUNK(_tc) do { \\\n\tsize_t _flen = TC_HDR_SIZE + (_tc)->size; \\\n\tchar *_fptr = (char *)(_tc); \\\n\tVALGRIND_MAKE_MEM_NOACCESS(_fptr, _flen); \\\n} while(0)\n#else\n#define TC_INVALIDATE_FULL_VALGRIND_CHUNK(_tc) do { } while (0)\n#endif\n\n#define TC_INVALIDATE_FULL_CHUNK(_tc) do { \\\n\tTC_INVALIDATE_FULL_FILL_CHUNK(_tc); \\\n\tTC_INVALIDATE_FULL_VALGRIND_CHUNK(_tc); \\\n} while (0)\n\n#define TC_INVALIDATE_SHRINK_FILL_CHUNK(_tc, _new_size) do { \\\n\tif (unlikely(talloc_fill.enabled)) { \\\n\t\tsize_t _flen = (_tc)->size - (_new_size); \\\n\t\tchar *_fptr = (char *)TC_PTR_FROM_CHUNK(_tc); \\\n\t\t_fptr += (_new_size); \\\n\t\tmemset(_fptr, talloc_fill.fill_value, _flen); \\\n\t} \\\n} while (0)\n\n#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_NOACCESS)\n/* Mark the unused bytes not accessible */\n#define TC_INVALIDATE_SHRINK_VALGRIND_CHUNK(_tc, _new_size) do { \\\n\tsize_t _flen = (_tc)->size - (_new_size); \\\n\tchar *_fptr = (char *)TC_PTR_FROM_CHUNK(_tc); \\\n\t_fptr += (_new_size); \\\n\tVALGRIND_MAKE_MEM_NOACCESS(_fptr, _flen); \\\n} while (0)\n#else\n#define TC_INVALIDATE_SHRINK_VALGRIND_CHUNK(_tc, _new_size) do { } while (0)\n#endif\n\n#define TC_INVALIDATE_SHRINK_CHUNK(_tc, _new_size) do { \\\n\tTC_INVALIDATE_SHRINK_FILL_CHUNK(_tc, _new_size); \\\n\tTC_INVALIDATE_SHRINK_VALGRIND_CHUNK(_tc, _new_size); \\\n} while (0)\n\n#define TC_UNDEFINE_SHRINK_FILL_CHUNK(_tc, _new_size) do { \\\n\tif (unlikely(talloc_fill.enabled)) { \\\n\t\tsize_t _flen = (_tc)->size - (_new_size); \\\n\t\tchar *_fptr = (char *)TC_PTR_FROM_CHUNK(_tc); \\\n\t\t_fptr += (_new_size); \\\n\t\tmemset(_fptr, talloc_fill.fill_value, _flen); \\\n\t} \\\n} while (0)\n\n#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_UNDEFINED)\n/* Mark the unused bytes as undefined */\n#define TC_UNDEFINE_SHRINK_VALGRIND_CHUNK(_tc, _new_size) do { \\\n\tsize_t _flen = (_tc)->size - (_new_size); \\\n\tchar *_fptr = (char *)TC_PTR_FROM_CHUNK(_tc); \\\n\t_fptr += (_new_size); \\\n\tVALGRIND_MAKE_MEM_UNDEFINED(_fptr, _flen); \\\n} while (0)\n#else\n#define TC_UNDEFINE_SHRINK_VALGRIND_CHUNK(_tc, _new_size) do { } while (0)\n#endif\n\n#define TC_UNDEFINE_SHRINK_CHUNK(_tc, _new_size) do { \\\n\tTC_UNDEFINE_SHRINK_FILL_CHUNK(_tc, _new_size); \\\n\tTC_UNDEFINE_SHRINK_VALGRIND_CHUNK(_tc, _new_size); \\\n} while (0)\n\n#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_UNDEFINED)\n/* Mark the new bytes as undefined */\n#define TC_UNDEFINE_GROW_VALGRIND_CHUNK(_tc, _new_size) do { \\\n\tsize_t _old_used = TC_HDR_SIZE + (_tc)->size; \\\n\tsize_t _new_used = TC_HDR_SIZE + (_new_size); \\\n\tsize_t _flen = _new_used - _old_used; \\\n\tchar *_fptr = _old_used + (char *)(_tc); \\\n\tVALGRIND_MAKE_MEM_UNDEFINED(_fptr, _flen); \\\n} while (0)\n#else\n#define TC_UNDEFINE_GROW_VALGRIND_CHUNK(_tc, _new_size) do { } while (0)\n#endif\n\n#define TC_UNDEFINE_GROW_CHUNK(_tc, _new_size) do { \\\n\tTC_UNDEFINE_GROW_VALGRIND_CHUNK(_tc, _new_size); \\\n} while (0)\n\nstruct talloc_reference_handle {\n\tstruct talloc_reference_handle *next, *prev;\n\tvoid *ptr;\n\tconst char *location;\n};\n\nstruct talloc_memlimit {\n\tstruct talloc_chunk *parent;\n\tstruct talloc_memlimit *upper;\n\tsize_t max_size;\n\tsize_t cur_size;\n};\n\nstatic inline bool talloc_memlimit_check(struct talloc_memlimit *limit, size_t size);\nstatic inline void talloc_memlimit_grow(struct talloc_memlimit *limit,\n\t\t\t\tsize_t size);\nstatic inline void talloc_memlimit_shrink(struct talloc_memlimit *limit,\n\t\t\t\tsize_t size);\nstatic inline void tc_memlimit_update_on_free(struct talloc_chunk *tc);\n\nstatic inline void _tc_set_name_const(struct talloc_chunk *tc,\n\t\t\t\tconst char *name);\nstatic struct talloc_chunk *_vasprintf_tc(const void *t,\n\t\t\t\tconst char *fmt,\n\t\t\t\tva_list ap);\n\ntypedef int (*talloc_destructor_t)(void *);\n\nstruct talloc_pool_hdr;\n\nstruct talloc_chunk {\n\t/*\n\t * flags includes the talloc magic, which is randomised to\n\t * make overwrite attacks harder\n\t */\n\tunsigned flags;\n\n\t/*\n\t * If you have a logical tree like:\n\t *\n\t *           <parent>\n\t *           /   |   \\\n\t *          /    |    \\\n\t *         /     |     \\\n\t * <child 1> <child 2> <child 3>\n\t *\n\t * The actual talloc tree is:\n\t *\n\t *  <parent>\n\t *     |\n\t *  <child 1> - <child 2> - <child 3>\n\t *\n\t * The children are linked with next/prev pointers, and\n\t * child 1 is linked to the parent with parent/child\n\t * pointers.\n\t */\n\n\tstruct talloc_chunk *next, *prev;\n\tstruct talloc_chunk *parent, *child;\n\tstruct talloc_reference_handle *refs;\n\ttalloc_destructor_t destructor;\n\tconst char *name;\n\tsize_t size;\n\n\t/*\n\t * limit semantics:\n\t * if 'limit' is set it means all *new* children of the context will\n\t * be limited to a total aggregate size ox max_size for memory\n\t * allocations.\n\t * cur_size is used to keep track of the current use\n\t */\n\tstruct talloc_memlimit *limit;\n\n\t/*\n\t * For members of a pool (i.e. TALLOC_FLAG_POOLMEM is set), \"pool\"\n\t * is a pointer to the struct talloc_chunk of the pool that it was\n\t * allocated from. This way children can quickly find the pool to chew\n\t * from.\n\t */\n\tstruct talloc_pool_hdr *pool;\n};\n\nunion talloc_chunk_cast_u {\n\tuint8_t *ptr;\n\tstruct talloc_chunk *chunk;\n};\n\n/* 16 byte alignment seems to keep everyone happy */\n#define TC_ALIGN16(s) (((s)+15)&~15)\n#define TC_HDR_SIZE TC_ALIGN16(sizeof(struct talloc_chunk))\n#define TC_PTR_FROM_CHUNK(tc) ((void *)(TC_HDR_SIZE + (char*)tc))\n\n_PUBLIC_ int talloc_version_major(void)\n{\n\treturn TALLOC_VERSION_MAJOR;\n}\n\n_PUBLIC_ int talloc_version_minor(void)\n{\n\treturn TALLOC_VERSION_MINOR;\n}\n\n_PUBLIC_ int talloc_test_get_magic(void)\n{\n\treturn talloc_magic;\n}\n\nstatic inline void _talloc_chunk_set_free(struct talloc_chunk *tc,\n\t\t\t      const char *location)\n{\n\t/*\n\t * Mark this memory as free, and also over-stamp the talloc\n\t * magic with the old-style magic.\n\t *\n\t * Why?  This tries to avoid a memory read use-after-free from\n\t * disclosing our talloc magic, which would then allow an\n\t * attacker to prepare a valid header and so run a destructor.\n\t *\n\t */\n\ttc->flags = TALLOC_MAGIC_NON_RANDOM | TALLOC_FLAG_FREE\n\t\t| (tc->flags & TALLOC_FLAG_MASK);\n\n\t/* we mark the freed memory with where we called the free\n\t * from. This means on a double free error we can report where\n\t * the first free came from\n\t */\n\tif (location) {\n\t\ttc->name = location;\n\t}\n}\n\nstatic inline void _talloc_chunk_set_not_free(struct talloc_chunk *tc)\n{\n\t/*\n\t * Mark this memory as not free.\n\t *\n\t * Why? This is memory either in a pool (and so available for\n\t * talloc's re-use or after the realloc().  We need to mark\n\t * the memory as free() before any realloc() call as we can't\n\t * write to the memory after that.\n\t *\n\t * We put back the normal magic instead of the 'not random'\n\t * magic.\n\t */\n\n\ttc->flags = talloc_magic |\n\t\t((tc->flags & TALLOC_FLAG_MASK) & ~TALLOC_FLAG_FREE);\n}\n\nstatic void (*talloc_log_fn)(const char *message);\n\n_PUBLIC_ void talloc_set_log_fn(void (*log_fn)(const char *message))\n{\n\ttalloc_log_fn = log_fn;\n}\n\n#ifdef HAVE_CONSTRUCTOR_ATTRIBUTE\n#define CONSTRUCTOR __attribute__((constructor))\n#elif defined(HAVE_PRAGMA_INIT)\n#define CONSTRUCTOR\n#pragma init (talloc_lib_init)\n#endif\n#if defined(HAVE_CONSTRUCTOR_ATTRIBUTE) || defined(HAVE_PRAGMA_INIT)\nvoid talloc_lib_init(void) CONSTRUCTOR;\nvoid talloc_lib_init(void)\n{\n\tuint32_t random_value;\n#if defined(HAVE_GETAUXVAL) && defined(AT_RANDOM)\n\tuint8_t *p;\n\t/*\n\t * Use the kernel-provided random values used for\n\t * ASLR.  This won't change per-exec, which is ideal for us\n\t */\n\tp = (uint8_t *) getauxval(AT_RANDOM);\n\tif (p) {\n\t\t/*\n\t\t * We get 16 bytes from getauxval.  By calling rand(),\n\t\t * a totally insecure PRNG, but one that will\n\t\t * deterministically have a different value when called\n\t\t * twice, we ensure that if two talloc-like libraries\n\t\t * are somehow loaded in the same address space, that\n\t\t * because we choose different bytes, we will keep the\n\t\t * protection against collision of multiple talloc\n\t\t * libs.\n\t\t *\n\t\t * This protection is important because the effects of\n\t\t * passing a talloc pointer from one to the other may\n\t\t * be very hard to determine.\n\t\t */\n\t\tint offset = rand() % (16 - sizeof(random_value));\n\t\tmemcpy(&random_value, p + offset, sizeof(random_value));\n\t} else\n#endif\n\t{\n\t\t/*\n\t\t * Otherwise, hope the location we are loaded in\n\t\t * memory is randomised by someone else\n\t\t */\n\t\trandom_value = ((uintptr_t)talloc_lib_init & 0xFFFFFFFF);\n\t}\n\ttalloc_magic = random_value & ~TALLOC_FLAG_MASK;\n}\n#else\n#warning \"No __attribute__((constructor)) support found on this platform, additional talloc security measures not available\"\n#endif\n\nstatic void talloc_lib_atexit(void)\n{\n\tTALLOC_FREE(autofree_context);\n\n\tif (talloc_total_size(null_context) == 0) {\n\t\treturn;\n\t}\n\n\tif (talloc_report_null_full) {\n\t\ttalloc_report_full(null_context, stderr);\n\t} else if (talloc_report_null) {\n\t\ttalloc_report(null_context, stderr);\n\t}\n}\n\nstatic void talloc_setup_atexit(void)\n{\n\tstatic bool done;\n\n\tif (done) {\n\t\treturn;\n\t}\n\n\tatexit(talloc_lib_atexit);\n\tdone = true;\n}\n\nstatic void talloc_log(const char *fmt, ...) PRINTF_ATTRIBUTE(1,2);\nstatic void talloc_log(const char *fmt, ...)\n{\n\tva_list ap;\n\tchar *message;\n\n\tif (!talloc_log_fn) {\n\t\treturn;\n\t}\n\n\tva_start(ap, fmt);\n\tmessage = talloc_vasprintf(NULL, fmt, ap);\n\tva_end(ap);\n\n\ttalloc_log_fn(message);\n\ttalloc_free(message);\n}\n\nstatic void talloc_log_stderr(const char *message)\n{\n\tfprintf(stderr, \"%s\", message);\n}\n\n_PUBLIC_ void talloc_set_log_stderr(void)\n{\n\ttalloc_set_log_fn(talloc_log_stderr);\n}\n\nstatic void (*talloc_abort_fn)(const char *reason);\n\n_PUBLIC_ void talloc_set_abort_fn(void (*abort_fn)(const char *reason))\n{\n\ttalloc_abort_fn = abort_fn;\n}\n\nstatic void talloc_abort(const char *reason)\n{\n\ttalloc_log(\"%s\\n\", reason);\n\n\tif (!talloc_abort_fn) {\n\t\tTALLOC_ABORT(reason);\n\t}\n\n\ttalloc_abort_fn(reason);\n}\n\nstatic void talloc_abort_access_after_free(void)\n{\n\ttalloc_abort(\"Bad talloc magic value - access after free\");\n}\n\nstatic void talloc_abort_unknown_value(void)\n{\n\ttalloc_abort(\"Bad talloc magic value - unknown value\");\n}\n\n/* panic if we get a bad magic value */\nstatic inline struct talloc_chunk *talloc_chunk_from_ptr(const void *ptr)\n{\n\tconst char *pp = (const char *)ptr;\n\tstruct talloc_chunk *tc = discard_const_p(struct talloc_chunk, pp - TC_HDR_SIZE);\n\tif (unlikely((tc->flags & (TALLOC_FLAG_FREE | ~TALLOC_FLAG_MASK)) != talloc_magic)) {\n\t\tif ((tc->flags & (TALLOC_FLAG_FREE | ~TALLOC_FLAG_MASK))\n\t\t    == (TALLOC_MAGIC_NON_RANDOM | TALLOC_FLAG_FREE)) {\n\t\t\ttalloc_log(\"talloc: access after free error - first free may be at %s\\n\", tc->name);\n\t\t\ttalloc_abort_access_after_free();\n\t\t\treturn NULL;\n\t\t}\n\n\t\ttalloc_abort_unknown_value();\n\t\treturn NULL;\n\t}\n\treturn tc;\n}\n\n/* hook into the front of the list */\n#define _TLIST_ADD(list, p) \\\ndo { \\\n        if (!(list)) { \\\n\t\t(list) = (p); \\\n\t\t(p)->next = (p)->prev = NULL; \\\n\t} else { \\\n\t\t(list)->prev = (p); \\\n\t\t(p)->next = (list); \\\n\t\t(p)->prev = NULL; \\\n\t\t(list) = (p); \\\n\t}\\\n} while (0)\n\n/* remove an element from a list - element doesn't have to be in list. */\n#define _TLIST_REMOVE(list, p) \\\ndo { \\\n\tif ((p) == (list)) { \\\n\t\t(list) = (p)->next; \\\n\t\tif (list) (list)->prev = NULL; \\\n\t} else { \\\n\t\tif ((p)->prev) (p)->prev->next = (p)->next; \\\n\t\tif ((p)->next) (p)->next->prev = (p)->prev; \\\n\t} \\\n\tif ((p) && ((p) != (list))) (p)->next = (p)->prev = NULL; \\\n} while (0)\n\n\n/*\n  return the parent chunk of a pointer\n*/\nstatic inline struct talloc_chunk *talloc_parent_chunk(const void *ptr)\n{\n\tstruct talloc_chunk *tc;\n\n\tif (unlikely(ptr == NULL)) {\n\t\treturn NULL;\n\t}\n\n\ttc = talloc_chunk_from_ptr(ptr);\n\twhile (tc->prev) tc=tc->prev;\n\n\treturn tc->parent;\n}\n\n_PUBLIC_ void *talloc_parent(const void *ptr)\n{\n\tstruct talloc_chunk *tc = talloc_parent_chunk(ptr);\n\treturn tc? TC_PTR_FROM_CHUNK(tc) : NULL;\n}\n\n/*\n  find parents name\n*/\n_PUBLIC_ const char *talloc_parent_name(const void *ptr)\n{\n\tstruct talloc_chunk *tc = talloc_parent_chunk(ptr);\n\treturn tc? tc->name : NULL;\n}\n\n/*\n  A pool carries an in-pool object count count in the first 16 bytes.\n  bytes. This is done to support talloc_steal() to a parent outside of the\n  pool. The count includes the pool itself, so a talloc_free() on a pool will\n  only destroy the pool if the count has dropped to zero. A talloc_free() of a\n  pool member will reduce the count, and eventually also call free(3) on the\n  pool memory.\n\n  The object count is not put into \"struct talloc_chunk\" because it is only\n  relevant for talloc pools and the alignment to 16 bytes would increase the\n  memory footprint of each talloc chunk by those 16 bytes.\n*/\n\nstruct talloc_pool_hdr {\n\tvoid *end;\n\tunsigned int object_count;\n\tsize_t poolsize;\n};\n\nunion talloc_pool_hdr_cast_u {\n\tuint8_t *ptr;\n\tstruct talloc_pool_hdr *hdr;\n};\n\n#define TP_HDR_SIZE TC_ALIGN16(sizeof(struct talloc_pool_hdr))\n\nstatic inline struct talloc_pool_hdr *talloc_pool_from_chunk(struct talloc_chunk *c)\n{\n\tunion talloc_chunk_cast_u tcc = { .chunk = c };\n\tunion talloc_pool_hdr_cast_u tphc = { tcc.ptr - TP_HDR_SIZE };\n\treturn tphc.hdr;\n}\n\nstatic inline struct talloc_chunk *talloc_chunk_from_pool(struct talloc_pool_hdr *h)\n{\n\tunion talloc_pool_hdr_cast_u tphc = { .hdr = h };\n\tunion talloc_chunk_cast_u tcc = { .ptr = tphc.ptr + TP_HDR_SIZE };\n\treturn tcc.chunk;\n}\n\nstatic inline void *tc_pool_end(struct talloc_pool_hdr *pool_hdr)\n{\n\tstruct talloc_chunk *tc = talloc_chunk_from_pool(pool_hdr);\n\treturn (char *)tc + TC_HDR_SIZE + pool_hdr->poolsize;\n}\n\nstatic inline size_t tc_pool_space_left(struct talloc_pool_hdr *pool_hdr)\n{\n\treturn (char *)tc_pool_end(pool_hdr) - (char *)pool_hdr->end;\n}\n\n/* If tc is inside a pool, this gives the next neighbour. */\nstatic inline void *tc_next_chunk(struct talloc_chunk *tc)\n{\n\treturn (char *)tc + TC_ALIGN16(TC_HDR_SIZE + tc->size);\n}\n\nstatic inline void *tc_pool_first_chunk(struct talloc_pool_hdr *pool_hdr)\n{\n\tstruct talloc_chunk *tc = talloc_chunk_from_pool(pool_hdr);\n\treturn tc_next_chunk(tc);\n}\n\n/* Mark the whole remaining pool as not accessible */\nstatic inline void tc_invalidate_pool(struct talloc_pool_hdr *pool_hdr)\n{\n\tsize_t flen = tc_pool_space_left(pool_hdr);\n\n\tif (unlikely(talloc_fill.enabled)) {\n\t\tmemset(pool_hdr->end, talloc_fill.fill_value, flen);\n\t}\n\n#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_NOACCESS)\n\tVALGRIND_MAKE_MEM_NOACCESS(pool_hdr->end, flen);\n#endif\n}\n\n/*\n  Allocate from a pool\n*/\n\nstatic inline struct talloc_chunk *tc_alloc_pool(struct talloc_chunk *parent,\n\t\t\t\t\t\t     size_t size, size_t prefix_len)\n{\n\tstruct talloc_pool_hdr *pool_hdr = NULL;\n\tunion talloc_chunk_cast_u tcc;\n\tsize_t space_left;\n\tstruct talloc_chunk *result;\n\tsize_t chunk_size;\n\n\tif (parent == NULL) {\n\t\treturn NULL;\n\t}\n\n\tif (parent->flags & TALLOC_FLAG_POOL) {\n\t\tpool_hdr = talloc_pool_from_chunk(parent);\n\t}\n\telse if (parent->flags & TALLOC_FLAG_POOLMEM) {\n\t\tpool_hdr = parent->pool;\n\t}\n\n\tif (pool_hdr == NULL) {\n\t\treturn NULL;\n\t}\n\n\tspace_left = tc_pool_space_left(pool_hdr);\n\n\t/*\n\t * Align size to 16 bytes\n\t */\n\tchunk_size = TC_ALIGN16(size + prefix_len);\n\n\tif (space_left < chunk_size) {\n\t\treturn NULL;\n\t}\n\n\ttcc = (union talloc_chunk_cast_u) {\n\t\t.ptr = ((uint8_t *)pool_hdr->end) + prefix_len\n\t};\n\tresult = tcc.chunk;\n\n#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_UNDEFINED)\n\tVALGRIND_MAKE_MEM_UNDEFINED(pool_hdr->end, chunk_size);\n#endif\n\n\tpool_hdr->end = (void *)((char *)pool_hdr->end + chunk_size);\n\n\tresult->flags = talloc_magic | TALLOC_FLAG_POOLMEM;\n\tresult->pool = pool_hdr;\n\n\tpool_hdr->object_count++;\n\n\treturn result;\n}\n\n/*\n   Allocate a bit of memory as a child of an existing pointer\n*/\nstatic inline void *__talloc_with_prefix(const void *context,\n\t\t\t\t\tsize_t size,\n\t\t\t\t\tsize_t prefix_len,\n\t\t\t\t\tstruct talloc_chunk **tc_ret)\n{\n\tstruct talloc_chunk *tc = NULL;\n\tstruct talloc_memlimit *limit = NULL;\n\tsize_t total_len = TC_HDR_SIZE + size + prefix_len;\n\tstruct talloc_chunk *parent = NULL;\n\n\tif (unlikely(context == NULL)) {\n\t\tcontext = null_context;\n\t}\n\n\tif (unlikely(size >= MAX_TALLOC_SIZE)) {\n\t\treturn NULL;\n\t}\n\n\tif (unlikely(total_len < TC_HDR_SIZE)) {\n\t\treturn NULL;\n\t}\n\n\tif (likely(context != NULL)) {\n\t\tparent = talloc_chunk_from_ptr(context);\n\n\t\tif (parent->limit != NULL) {\n\t\t\tlimit = parent->limit;\n\t\t}\n\n\t\ttc = tc_alloc_pool(parent, TC_HDR_SIZE+size, prefix_len);\n\t}\n\n\tif (tc == NULL) {\n\t\tuint8_t *ptr = NULL;\n\t\tunion talloc_chunk_cast_u tcc;\n\n\t\t/*\n\t\t * Only do the memlimit check/update on actual allocation.\n\t\t */\n\t\tif (!talloc_memlimit_check(limit, total_len)) {\n\t\t\terrno = ENOMEM;\n\t\t\treturn NULL;\n\t\t}\n\n\t\tptr = malloc(total_len);\n\t\tif (unlikely(ptr == NULL)) {\n\t\t\treturn NULL;\n\t\t}\n\t\ttcc = (union talloc_chunk_cast_u) { .ptr = ptr + prefix_len };\n\t\ttc = tcc.chunk;\n\t\ttc->flags = talloc_magic;\n\t\ttc->pool  = NULL;\n\n\t\ttalloc_memlimit_grow(limit, total_len);\n\t}\n\n\ttc->limit = limit;\n\ttc->size = size;\n\ttc->destructor = NULL;\n\ttc->child = NULL;\n\ttc->name = NULL;\n\ttc->refs = NULL;\n\n\tif (likely(context != NULL)) {\n\t\tif (parent->child) {\n\t\t\tparent->child->parent = NULL;\n\t\t\ttc->next = parent->child;\n\t\t\ttc->next->prev = tc;\n\t\t} else {\n\t\t\ttc->next = NULL;\n\t\t}\n\t\ttc->parent = parent;\n\t\ttc->prev = NULL;\n\t\tparent->child = tc;\n\t} else {\n\t\ttc->next = tc->prev = tc->parent = NULL;\n\t}\n\n\t*tc_ret = tc;\n\treturn TC_PTR_FROM_CHUNK(tc);\n}\n\nstatic inline void *__talloc(const void *context,\n\t\t\tsize_t size,\n\t\t\tstruct talloc_chunk **tc)\n{\n\treturn __talloc_with_prefix(context, size, 0, tc);\n}\n\n/*\n * Create a talloc pool\n */\n\nstatic inline void *_talloc_pool(const void *context, size_t size)\n{\n\tstruct talloc_chunk *tc = NULL;\n\tstruct talloc_pool_hdr *pool_hdr;\n\tvoid *result;\n\n\tresult = __talloc_with_prefix(context, size, TP_HDR_SIZE, &tc);\n\n\tif (unlikely(result == NULL)) {\n\t\treturn NULL;\n\t}\n\n\tpool_hdr = talloc_pool_from_chunk(tc);\n\n\ttc->flags |= TALLOC_FLAG_POOL;\n\ttc->size = 0;\n\n\tpool_hdr->object_count = 1;\n\tpool_hdr->end = result;\n\tpool_hdr->poolsize = size;\n\n\ttc_invalidate_pool(pool_hdr);\n\n\treturn result;\n}\n\n_PUBLIC_ void *talloc_pool(const void *context, size_t size)\n{\n\treturn _talloc_pool(context, size);\n}\n\n/*\n * Create a talloc pool correctly sized for a basic size plus\n * a number of subobjects whose total size is given. Essentially\n * a custom allocator for talloc to reduce fragmentation.\n */\n\n_PUBLIC_ void *_talloc_pooled_object(const void *ctx,\n\t\t\t\t     size_t type_size,\n\t\t\t\t     const char *type_name,\n\t\t\t\t     unsigned num_subobjects,\n\t\t\t\t     size_t total_subobjects_size)\n{\n\tsize_t poolsize, subobjects_slack, tmp;\n\tstruct talloc_chunk *tc;\n\tstruct talloc_pool_hdr *pool_hdr;\n\tvoid *ret;\n\n\tpoolsize = type_size + total_subobjects_size;\n\n\tif ((poolsize < type_size) || (poolsize < total_subobjects_size)) {\n\t\tgoto overflow;\n\t}\n\n\tif (num_subobjects == UINT_MAX) {\n\t\tgoto overflow;\n\t}\n\tnum_subobjects += 1;       /* the object body itself */\n\n\t/*\n\t * Alignment can increase the pool size by at most 15 bytes per object\n\t * plus alignment for the object itself\n\t */\n\tsubobjects_slack = (TC_HDR_SIZE + TP_HDR_SIZE + 15) * num_subobjects;\n\tif (subobjects_slack < num_subobjects) {\n\t\tgoto overflow;\n\t}\n\n\ttmp = poolsize + subobjects_slack;\n\tif ((tmp < poolsize) || (tmp < subobjects_slack)) {\n\t\tgoto overflow;\n\t}\n\tpoolsize = tmp;\n\n\tret = _talloc_pool(ctx, poolsize);\n\tif (ret == NULL) {\n\t\treturn NULL;\n\t}\n\n\ttc = talloc_chunk_from_ptr(ret);\n\ttc->size = type_size;\n\n\tpool_hdr = talloc_pool_from_chunk(tc);\n\n#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_UNDEFINED)\n\tVALGRIND_MAKE_MEM_UNDEFINED(pool_hdr->end, type_size);\n#endif\n\n\tpool_hdr->end = ((char *)pool_hdr->end + TC_ALIGN16(type_size));\n\n\t_tc_set_name_const(tc, type_name);\n\treturn ret;\n\noverflow:\n\treturn NULL;\n}\n\n/*\n  setup a destructor to be called on free of a pointer\n  the destructor should return 0 on success, or -1 on failure.\n  if the destructor fails then the free is failed, and the memory can\n  be continued to be used\n*/\n_PUBLIC_ void _talloc_set_destructor(const void *ptr, int (*destructor)(void *))\n{\n\tstruct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);\n\ttc->destructor = destructor;\n}\n\n/*\n  increase the reference count on a piece of memory.\n*/\n_PUBLIC_ int talloc_increase_ref_count(const void *ptr)\n{\n\tif (unlikely(!talloc_reference(null_context, ptr))) {\n\t\treturn -1;\n\t}\n\treturn 0;\n}\n\n/*\n  helper for talloc_reference()\n\n  this is referenced by a function pointer and should not be inline\n*/\nstatic int talloc_reference_destructor(struct talloc_reference_handle *handle)\n{\n\tstruct talloc_chunk *ptr_tc = talloc_chunk_from_ptr(handle->ptr);\n\t_TLIST_REMOVE(ptr_tc->refs, handle);\n\treturn 0;\n}\n\n/*\n   more efficient way to add a name to a pointer - the name must point to a\n   true string constant\n*/\nstatic inline void _tc_set_name_const(struct talloc_chunk *tc,\n\t\t\t\t\tconst char *name)\n{\n\ttc->name = name;\n}\n\n/*\n  internal talloc_named_const()\n*/\nstatic inline void *_talloc_named_const(const void *context, size_t size, const char *name)\n{\n\tvoid *ptr;\n\tstruct talloc_chunk *tc = NULL;\n\n\tptr = __talloc(context, size, &tc);\n\tif (unlikely(ptr == NULL)) {\n\t\treturn NULL;\n\t}\n\n\t_tc_set_name_const(tc, name);\n\n\treturn ptr;\n}\n\n/*\n  make a secondary reference to a pointer, hanging off the given context.\n  the pointer remains valid until both the original caller and this given\n  context are freed.\n\n  the major use for this is when two different structures need to reference the\n  same underlying data, and you want to be able to free the two instances separately,\n  and in either order\n*/\n_PUBLIC_ void *_talloc_reference_loc(const void *context, const void *ptr, const char *location)\n{\n\tstruct talloc_chunk *tc;\n\tstruct talloc_reference_handle *handle;\n\tif (unlikely(ptr == NULL)) return NULL;\n\n\ttc = talloc_chunk_from_ptr(ptr);\n\thandle = (struct talloc_reference_handle *)_talloc_named_const(context,\n\t\t\t\t\t\t   sizeof(struct talloc_reference_handle),\n\t\t\t\t\t\t   TALLOC_MAGIC_REFERENCE);\n\tif (unlikely(handle == NULL)) return NULL;\n\n\t/* note that we hang the destructor off the handle, not the\n\t   main context as that allows the caller to still setup their\n\t   own destructor on the context if they want to */\n\ttalloc_set_destructor(handle, talloc_reference_destructor);\n\thandle->ptr = discard_const_p(void, ptr);\n\thandle->location = location;\n\t_TLIST_ADD(tc->refs, handle);\n\treturn handle->ptr;\n}\n\nstatic void *_talloc_steal_internal(const void *new_ctx, const void *ptr);\n\nstatic inline void _tc_free_poolmem(struct talloc_chunk *tc,\n\t\t\t\t\tconst char *location)\n{\n\tstruct talloc_pool_hdr *pool;\n\tstruct talloc_chunk *pool_tc;\n\tvoid *next_tc;\n\n\tpool = tc->pool;\n\tpool_tc = talloc_chunk_from_pool(pool);\n\tnext_tc = tc_next_chunk(tc);\n\n\t_talloc_chunk_set_free(tc, location);\n\n\tTC_INVALIDATE_FULL_CHUNK(tc);\n\n\tif (unlikely(pool->object_count == 0)) {\n\t\ttalloc_abort(\"Pool object count zero!\");\n\t\treturn;\n\t}\n\n\tpool->object_count--;\n\n\tif (unlikely(pool->object_count == 1\n\t\t     && !(pool_tc->flags & TALLOC_FLAG_FREE))) {\n\t\t/*\n\t\t * if there is just one object left in the pool\n\t\t * and pool->flags does not have TALLOC_FLAG_FREE,\n\t\t * it means this is the pool itself and\n\t\t * the rest is available for new objects\n\t\t * again.\n\t\t */\n\t\tpool->end = tc_pool_first_chunk(pool);\n\t\ttc_invalidate_pool(pool);\n\t\treturn;\n\t}\n\n\tif (unlikely(pool->object_count == 0)) {\n\t\t/*\n\t\t * we mark the freed memory with where we called the free\n\t\t * from. This means on a double free error we can report where\n\t\t * the first free came from\n\t\t */\n\t\tpool_tc->name = location;\n\n\t\tif (pool_tc->flags & TALLOC_FLAG_POOLMEM) {\n\t\t\t_tc_free_poolmem(pool_tc, location);\n\t\t} else {\n\t\t\t/*\n\t\t\t * The tc_memlimit_update_on_free()\n\t\t\t * call takes into account the\n\t\t\t * prefix TP_HDR_SIZE allocated before\n\t\t\t * the pool talloc_chunk.\n\t\t\t */\n\t\t\ttc_memlimit_update_on_free(pool_tc);\n\t\t\tTC_INVALIDATE_FULL_CHUNK(pool_tc);\n\t\t\tfree(pool);\n\t\t}\n\t\treturn;\n\t}\n\n\tif (pool->end == next_tc) {\n\t\t/*\n\t\t * if pool->pool still points to end of\n\t\t * 'tc' (which is stored in the 'next_tc' variable),\n\t\t * we can reclaim the memory of 'tc'.\n\t\t */\n\t\tpool->end = tc;\n\t\treturn;\n\t}\n\n\t/*\n\t * Do nothing. The memory is just \"wasted\", waiting for the pool\n\t * itself to be freed.\n\t */\n}\n\nstatic inline void _tc_free_children_internal(struct talloc_chunk *tc,\n\t\t\t\t\t\t  void *ptr,\n\t\t\t\t\t\t  const char *location);\n\nstatic inline int _talloc_free_internal(void *ptr, const char *location);\n\n/*\n   internal free call that takes a struct talloc_chunk *.\n*/\nstatic inline int _tc_free_internal(struct talloc_chunk *tc,\n\t\t\t\tconst char *location)\n{\n\tvoid *ptr_to_free;\n\tvoid *ptr = TC_PTR_FROM_CHUNK(tc);\n\n\tif (unlikely(tc->refs)) {\n\t\tint is_child;\n\t\t/* check if this is a reference from a child or\n\t\t * grandchild back to it's parent or grandparent\n\t\t *\n\t\t * in that case we need to remove the reference and\n\t\t * call another instance of talloc_free() on the current\n\t\t * pointer.\n\t\t */\n\t\tis_child = talloc_is_parent(tc->refs, ptr);\n\t\t_talloc_free_internal(tc->refs, location);\n\t\tif (is_child) {\n\t\t\treturn _talloc_free_internal(ptr, location);\n\t\t}\n\t\treturn -1;\n\t}\n\n\tif (unlikely(tc->flags & TALLOC_FLAG_LOOP)) {\n\t\t/* we have a free loop - stop looping */\n\t\treturn 0;\n\t}\n\n\tif (unlikely(tc->destructor)) {\n\t\ttalloc_destructor_t d = tc->destructor;\n\n\t\t/*\n\t\t * Protect the destructor against some overwrite\n\t\t * attacks, by explicitly checking it has the right\n\t\t * magic here.\n\t\t */\n\t\tif (talloc_chunk_from_ptr(ptr) != tc) {\n\t\t\t/*\n\t\t\t * This can't actually happen, the\n\t\t\t * call itself will panic.\n\t\t\t */\n\t\t\tTALLOC_ABORT(\"talloc_chunk_from_ptr failed!\");\n\t\t}\n\n\t\tif (d == (talloc_destructor_t)-1) {\n\t\t\treturn -1;\n\t\t}\n\t\ttc->destructor = (talloc_destructor_t)-1;\n\t\tif (d(ptr) == -1) {\n\t\t\t/*\n\t\t\t * Only replace the destructor pointer if\n\t\t\t * calling the destructor didn't modify it.\n\t\t\t */\n\t\t\tif (tc->destructor == (talloc_destructor_t)-1) {\n\t\t\t\ttc->destructor = d;\n\t\t\t}\n\t\t\treturn -1;\n\t\t}\n\t\ttc->destructor = NULL;\n\t}\n\n\tif (tc->parent) {\n\t\t_TLIST_REMOVE(tc->parent->child, tc);\n\t\tif (tc->parent->child) {\n\t\t\ttc->parent->child->parent = tc->parent;\n\t\t}\n\t} else {\n\t\tif (tc->prev) tc->prev->next = tc->next;\n\t\tif (tc->next) tc->next->prev = tc->prev;\n\t\ttc->prev = tc->next = NULL;\n\t}\n\n\ttc->flags |= TALLOC_FLAG_LOOP;\n\n\t_tc_free_children_internal(tc, ptr, location);\n\n\t_talloc_chunk_set_free(tc, location);\n\n\tif (tc->flags & TALLOC_FLAG_POOL) {\n\t\tstruct talloc_pool_hdr *pool;\n\n\t\tpool = talloc_pool_from_chunk(tc);\n\n\t\tif (unlikely(pool->object_count == 0)) {\n\t\t\ttalloc_abort(\"Pool object count zero!\");\n\t\t\treturn 0;\n\t\t}\n\n\t\tpool->object_count--;\n\n\t\tif (likely(pool->object_count != 0)) {\n\t\t\treturn 0;\n\t\t}\n\n\t\t/*\n\t\t * With object_count==0, a pool becomes a normal piece of\n\t\t * memory to free. If it's allocated inside a pool, it needs\n\t\t * to be freed as poolmem, else it needs to be just freed.\n\t\t*/\n\t\tptr_to_free = pool;\n\t} else {\n\t\tptr_to_free = tc;\n\t}\n\n\tif (tc->flags & TALLOC_FLAG_POOLMEM) {\n\t\t_tc_free_poolmem(tc, location);\n\t\treturn 0;\n\t}\n\n\ttc_memlimit_update_on_free(tc);\n\n\tTC_INVALIDATE_FULL_CHUNK(tc);\n\tfree(ptr_to_free);\n\treturn 0;\n}\n\n/*\n   internal talloc_free call\n*/\nstatic inline int _talloc_free_internal(void *ptr, const char *location)\n{\n\tstruct talloc_chunk *tc;\n\n\tif (unlikely(ptr == NULL)) {\n\t\treturn -1;\n\t}\n\n\t/* possibly initialised the talloc fill value */\n\tif (unlikely(!talloc_fill.initialised)) {\n\t\tconst char *fill = getenv(TALLOC_FILL_ENV);\n\t\tif (fill != NULL) {\n\t\t\ttalloc_fill.enabled = true;\n\t\t\ttalloc_fill.fill_value = strtoul(fill, NULL, 0);\n\t\t}\n\t\ttalloc_fill.initialised = true;\n\t}\n\n\ttc = talloc_chunk_from_ptr(ptr);\n\treturn _tc_free_internal(tc, location);\n}\n\nstatic inline size_t _talloc_total_limit_size(const void *ptr,\n\t\t\t\t\tstruct talloc_memlimit *old_limit,\n\t\t\t\t\tstruct talloc_memlimit *new_limit);\n\n/*\n   move a lump of memory from one talloc context to another returning the\n   ptr on success, or NULL if it could not be transferred.\n   passing NULL as ptr will always return NULL with no side effects.\n*/\nstatic void *_talloc_steal_internal(const void *new_ctx, const void *ptr)\n{\n\tstruct talloc_chunk *tc, *new_tc;\n\tsize_t ctx_size = 0;\n\n\tif (unlikely(!ptr)) {\n\t\treturn NULL;\n\t}\n\n\tif (unlikely(new_ctx == NULL)) {\n\t\tnew_ctx = null_context;\n\t}\n\n\ttc = talloc_chunk_from_ptr(ptr);\n\n\tif (tc->limit != NULL) {\n\n\t\tctx_size = _talloc_total_limit_size(ptr, NULL, NULL);\n\n\t\t/* Decrement the memory limit from the source .. */\n\t\ttalloc_memlimit_shrink(tc->limit->upper, ctx_size);\n\n\t\tif (tc->limit->parent == tc) {\n\t\t\ttc->limit->upper = NULL;\n\t\t} else {\n\t\t\ttc->limit = NULL;\n\t\t}\n\t}\n\n\tif (unlikely(new_ctx == NULL)) {\n\t\tif (tc->parent) {\n\t\t\t_TLIST_REMOVE(tc->parent->child, tc);\n\t\t\tif (tc->parent->child) {\n\t\t\t\ttc->parent->child->parent = tc->parent;\n\t\t\t}\n\t\t} else {\n\t\t\tif (tc->prev) tc->prev->next = tc->next;\n\t\t\tif (tc->next) tc->next->prev = tc->prev;\n\t\t}\n\n\t\ttc->parent = tc->next = tc->prev = NULL;\n\t\treturn discard_const_p(void, ptr);\n\t}\n\n\tnew_tc = talloc_chunk_from_ptr(new_ctx);\n\n\tif (unlikely(tc == new_tc || tc->parent == new_tc)) {\n\t\treturn discard_const_p(void, ptr);\n\t}\n\n\tif (tc->parent) {\n\t\t_TLIST_REMOVE(tc->parent->child, tc);\n\t\tif (tc->parent->child) {\n\t\t\ttc->parent->child->parent = tc->parent;\n\t\t}\n\t} else {\n\t\tif (tc->prev) tc->prev->next = tc->next;\n\t\tif (tc->next) tc->next->prev = tc->prev;\n\t\ttc->prev = tc->next = NULL;\n\t}\n\n\ttc->parent = new_tc;\n\tif (new_tc->child) new_tc->child->parent = NULL;\n\t_TLIST_ADD(new_tc->child, tc);\n\n\tif (tc->limit || new_tc->limit) {\n\t\tctx_size = _talloc_total_limit_size(ptr, tc->limit,\n\t\t\t\t\t\t    new_tc->limit);\n\t\t/* .. and increment it in the destination. */\n\t\tif (new_tc->limit) {\n\t\t\ttalloc_memlimit_grow(new_tc->limit, ctx_size);\n\t\t}\n\t}\n\n\treturn discard_const_p(void, ptr);\n}\n\n/*\n   move a lump of memory from one talloc context to another returning the\n   ptr on success, or NULL if it could not be transferred.\n   passing NULL as ptr will always return NULL with no side effects.\n*/\n_PUBLIC_ void *_talloc_steal_loc(const void *new_ctx, const void *ptr, const char *location)\n{\n\tstruct talloc_chunk *tc;\n\n\tif (unlikely(ptr == NULL)) {\n\t\treturn NULL;\n\t}\n\n\ttc = talloc_chunk_from_ptr(ptr);\n\n\tif (unlikely(tc->refs != NULL) && talloc_parent(ptr) != new_ctx) {\n\t\tstruct talloc_reference_handle *h;\n\n\t\ttalloc_log(\"WARNING: talloc_steal with references at %s\\n\",\n\t\t\t   location);\n\n\t\tfor (h=tc->refs; h; h=h->next) {\n\t\t\ttalloc_log(\"\\treference at %s\\n\",\n\t\t\t\t   h->location);\n\t\t}\n\t}\n\n#if 0\n\t/* this test is probably too expensive to have on in the\n\t   normal build, but it useful for debugging */\n\tif (talloc_is_parent(new_ctx, ptr)) {\n\t\ttalloc_log(\"WARNING: stealing into talloc child at %s\\n\", location);\n\t}\n#endif\n\n\treturn _talloc_steal_internal(new_ctx, ptr);\n}\n\n/*\n   this is like a talloc_steal(), but you must supply the old\n   parent. This resolves the ambiguity in a talloc_steal() which is\n   called on a context that has more than one parent (via references)\n\n   The old parent can be either a reference or a parent\n*/\n_PUBLIC_ void *talloc_reparent(const void *old_parent, const void *new_parent, const void *ptr)\n{\n\tstruct talloc_chunk *tc;\n\tstruct talloc_reference_handle *h;\n\n\tif (unlikely(ptr == NULL)) {\n\t\treturn NULL;\n\t}\n\n\tif (old_parent == talloc_parent(ptr)) {\n\t\treturn _talloc_steal_internal(new_parent, ptr);\n\t}\n\n\ttc = talloc_chunk_from_ptr(ptr);\n\tfor (h=tc->refs;h;h=h->next) {\n\t\tif (talloc_parent(h) == old_parent) {\n\t\t\tif (_talloc_steal_internal(new_parent, h) != h) {\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t\treturn discard_const_p(void, ptr);\n\t\t}\n\t}\n\n\t/* it wasn't a parent */\n\treturn NULL;\n}\n\n/*\n  remove a secondary reference to a pointer. This undo's what\n  talloc_reference() has done. The context and pointer arguments\n  must match those given to a talloc_reference()\n*/\nstatic inline int talloc_unreference(const void *context, const void *ptr)\n{\n\tstruct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);\n\tstruct talloc_reference_handle *h;\n\n\tif (unlikely(context == NULL)) {\n\t\tcontext = null_context;\n\t}\n\n\tfor (h=tc->refs;h;h=h->next) {\n\t\tstruct talloc_chunk *p = talloc_parent_chunk(h);\n\t\tif (p == NULL) {\n\t\t\tif (context == NULL) break;\n\t\t} else if (TC_PTR_FROM_CHUNK(p) == context) {\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (h == NULL) {\n\t\treturn -1;\n\t}\n\n\treturn _talloc_free_internal(h, __location__);\n}\n\n/*\n  remove a specific parent context from a pointer. This is a more\n  controlled variant of talloc_free()\n*/\n\n/* coverity[ -tainted_data_sink : arg-1 ] */\n_PUBLIC_ int talloc_unlink(const void *context, void *ptr)\n{\n\tstruct talloc_chunk *tc_p, *new_p, *tc_c;\n\tvoid *new_parent;\n\n\tif (ptr == NULL) {\n\t\treturn -1;\n\t}\n\n\tif (context == NULL) {\n\t\tcontext = null_context;\n\t}\n\n\tif (talloc_unreference(context, ptr) == 0) {\n\t\treturn 0;\n\t}\n\n\tif (context != NULL) {\n\t\ttc_c = talloc_chunk_from_ptr(context);\n\t} else {\n\t\ttc_c = NULL;\n\t}\n\tif (tc_c != talloc_parent_chunk(ptr)) {\n\t\treturn -1;\n\t}\n\n\ttc_p = talloc_chunk_from_ptr(ptr);\n\n\tif (tc_p->refs == NULL) {\n\t\treturn _talloc_free_internal(ptr, __location__);\n\t}\n\n\tnew_p = talloc_parent_chunk(tc_p->refs);\n\tif (new_p) {\n\t\tnew_parent = TC_PTR_FROM_CHUNK(new_p);\n\t} else {\n\t\tnew_parent = NULL;\n\t}\n\n\tif (talloc_unreference(new_parent, ptr) != 0) {\n\t\treturn -1;\n\t}\n\n\t_talloc_steal_internal(new_parent, ptr);\n\n\treturn 0;\n}\n\n/*\n  add a name to an existing pointer - va_list version\n*/\nstatic inline const char *tc_set_name_v(struct talloc_chunk *tc,\n\t\t\t\tconst char *fmt,\n\t\t\t\tva_list ap) PRINTF_ATTRIBUTE(2,0);\n\nstatic inline const char *tc_set_name_v(struct talloc_chunk *tc,\n\t\t\t\tconst char *fmt,\n\t\t\t\tva_list ap)\n{\n\tstruct talloc_chunk *name_tc = _vasprintf_tc(TC_PTR_FROM_CHUNK(tc),\n\t\t\t\t\t\t\tfmt,\n\t\t\t\t\t\t\tap);\n\tif (likely(name_tc)) {\n\t\ttc->name = TC_PTR_FROM_CHUNK(name_tc);\n\t\t_tc_set_name_const(name_tc, \".name\");\n\t} else {\n\t\ttc->name = NULL;\n\t}\n\treturn tc->name;\n}\n\n/*\n  add a name to an existing pointer\n*/\n_PUBLIC_ const char *talloc_set_name(const void *ptr, const char *fmt, ...)\n{\n\tstruct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);\n\tconst char *name;\n\tva_list ap;\n\tva_start(ap, fmt);\n\tname = tc_set_name_v(tc, fmt, ap);\n\tva_end(ap);\n\treturn name;\n}\n\n\n/*\n  create a named talloc pointer. Any talloc pointer can be named, and\n  talloc_named() operates just like talloc() except that it allows you\n  to name the pointer.\n*/\n_PUBLIC_ void *talloc_named(const void *context, size_t size, const char *fmt, ...)\n{\n\tva_list ap;\n\tvoid *ptr;\n\tconst char *name;\n\tstruct talloc_chunk *tc = NULL;\n\n\tptr = __talloc(context, size, &tc);\n\tif (unlikely(ptr == NULL)) return NULL;\n\n\tva_start(ap, fmt);\n\tname = tc_set_name_v(tc, fmt, ap);\n\tva_end(ap);\n\n\tif (unlikely(name == NULL)) {\n\t\t_talloc_free_internal(ptr, __location__);\n\t\treturn NULL;\n\t}\n\n\treturn ptr;\n}\n\n/*\n  return the name of a talloc ptr, or \"UNNAMED\"\n*/\nstatic inline const char *__talloc_get_name(const void *ptr)\n{\n\tstruct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);\n\tif (unlikely(tc->name == TALLOC_MAGIC_REFERENCE)) {\n\t\treturn \".reference\";\n\t}\n\tif (likely(tc->name)) {\n\t\treturn tc->name;\n\t}\n\treturn \"UNNAMED\";\n}\n\n_PUBLIC_ const char *talloc_get_name(const void *ptr)\n{\n\treturn __talloc_get_name(ptr);\n}\n\n/*\n  check if a pointer has the given name. If it does, return the pointer,\n  otherwise return NULL\n*/\n_PUBLIC_ void *talloc_check_name(const void *ptr, const char *name)\n{\n\tconst char *pname;\n\tif (unlikely(ptr == NULL)) return NULL;\n\tpname = __talloc_get_name(ptr);\n\tif (likely(pname == name || strcmp(pname, name) == 0)) {\n\t\treturn discard_const_p(void, ptr);\n\t}\n\treturn NULL;\n}\n\nstatic void talloc_abort_type_mismatch(const char *location,\n\t\t\t\t\tconst char *name,\n\t\t\t\t\tconst char *expected)\n{\n\tconst char *reason;\n\n\treason = talloc_asprintf(NULL,\n\t\t\t\t \"%s: Type mismatch: name[%s] expected[%s]\",\n\t\t\t\t location,\n\t\t\t\t name?name:\"NULL\",\n\t\t\t\t expected);\n\tif (!reason) {\n\t\treason = \"Type mismatch\";\n\t}\n\n\ttalloc_abort(reason);\n}\n\n_PUBLIC_ void *_talloc_get_type_abort(const void *ptr, const char *name, const char *location)\n{\n\tconst char *pname;\n\n\tif (unlikely(ptr == NULL)) {\n\t\ttalloc_abort_type_mismatch(location, NULL, name);\n\t\treturn NULL;\n\t}\n\n\tpname = __talloc_get_name(ptr);\n\tif (likely(pname == name || strcmp(pname, name) == 0)) {\n\t\treturn discard_const_p(void, ptr);\n\t}\n\n\ttalloc_abort_type_mismatch(location, pname, name);\n\treturn NULL;\n}\n\n/*\n  this is for compatibility with older versions of talloc\n*/\n_PUBLIC_ void *talloc_init(const char *fmt, ...)\n{\n\tva_list ap;\n\tvoid *ptr;\n\tconst char *name;\n\tstruct talloc_chunk *tc = NULL;\n\n\tptr = __talloc(NULL, 0, &tc);\n\tif (unlikely(ptr == NULL)) return NULL;\n\n\tva_start(ap, fmt);\n\tname = tc_set_name_v(tc, fmt, ap);\n\tva_end(ap);\n\n\tif (unlikely(name == NULL)) {\n\t\t_talloc_free_internal(ptr, __location__);\n\t\treturn NULL;\n\t}\n\n\treturn ptr;\n}\n\nstatic inline void _tc_free_children_internal(struct talloc_chunk *tc,\n\t\t\t\t\t\t  void *ptr,\n\t\t\t\t\t\t  const char *location)\n{\n\twhile (tc->child) {\n\t\t/* we need to work out who will own an abandoned child\n\t\t   if it cannot be freed. In priority order, the first\n\t\t   choice is owner of any remaining reference to this\n\t\t   pointer, the second choice is our parent, and the\n\t\t   final choice is the null context. */\n\t\tvoid *child = TC_PTR_FROM_CHUNK(tc->child);\n\t\tconst void *new_parent = null_context;\n\t\tif (unlikely(tc->child->refs)) {\n\t\t\tstruct talloc_chunk *p = talloc_parent_chunk(tc->child->refs);\n\t\t\tif (p) new_parent = TC_PTR_FROM_CHUNK(p);\n\t\t}\n\t\tif (unlikely(_tc_free_internal(tc->child, location) == -1)) {\n\t\t\tif (talloc_parent_chunk(child) != tc) {\n\t\t\t\t/*\n\t\t\t\t * Destructor already reparented this child.\n\t\t\t\t * No further reparenting needed.\n\t\t\t\t */\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (new_parent == null_context) {\n\t\t\t\tstruct talloc_chunk *p = talloc_parent_chunk(ptr);\n\t\t\t\tif (p) new_parent = TC_PTR_FROM_CHUNK(p);\n\t\t\t}\n\t\t\t_talloc_steal_internal(new_parent, child);\n\t\t}\n\t}\n}\n\n/*\n  this is a replacement for the Samba3 talloc_destroy_pool functionality. It\n  should probably not be used in new code. It's in here to keep the talloc\n  code consistent across Samba 3 and 4.\n*/\n_PUBLIC_ void talloc_free_children(void *ptr)\n{\n\tstruct talloc_chunk *tc_name = NULL;\n\tstruct talloc_chunk *tc;\n\n\tif (unlikely(ptr == NULL)) {\n\t\treturn;\n\t}\n\n\ttc = talloc_chunk_from_ptr(ptr);\n\n\t/* we do not want to free the context name if it is a child .. */\n\tif (likely(tc->child)) {\n\t\tfor (tc_name = tc->child; tc_name; tc_name = tc_name->next) {\n\t\t\tif (tc->name == TC_PTR_FROM_CHUNK(tc_name)) break;\n\t\t}\n\t\tif (tc_name) {\n\t\t\t_TLIST_REMOVE(tc->child, tc_name);\n\t\t\tif (tc->child) {\n\t\t\t\ttc->child->parent = tc;\n\t\t\t}\n\t\t}\n\t}\n\n\t_tc_free_children_internal(tc, ptr, __location__);\n\n\t/* .. so we put it back after all other children have been freed */\n\tif (tc_name) {\n\t\tif (tc->child) {\n\t\t\ttc->child->parent = NULL;\n\t\t}\n\t\ttc_name->parent = tc;\n\t\t_TLIST_ADD(tc->child, tc_name);\n\t}\n}\n\n/*\n   Allocate a bit of memory as a child of an existing pointer\n*/\n_PUBLIC_ void *_talloc(const void *context, size_t size)\n{\n\tstruct talloc_chunk *tc;\n\treturn __talloc(context, size, &tc);\n}\n\n/*\n  externally callable talloc_set_name_const()\n*/\n_PUBLIC_ void talloc_set_name_const(const void *ptr, const char *name)\n{\n\t_tc_set_name_const(talloc_chunk_from_ptr(ptr), name);\n}\n\n/*\n  create a named talloc pointer. Any talloc pointer can be named, and\n  talloc_named() operates just like talloc() except that it allows you\n  to name the pointer.\n*/\n_PUBLIC_ void *talloc_named_const(const void *context, size_t size, const char *name)\n{\n\treturn _talloc_named_const(context, size, name);\n}\n\n/*\n   free a talloc pointer. This also frees all child pointers of this\n   pointer recursively\n\n   return 0 if the memory is actually freed, otherwise -1. The memory\n   will not be freed if the ref_count is > 1 or the destructor (if\n   any) returns non-zero\n*/\n_PUBLIC_ int _talloc_free(void *ptr, const char *location)\n{\n\tstruct talloc_chunk *tc;\n\n\tif (unlikely(ptr == NULL)) {\n\t\treturn -1;\n\t}\n\n\ttc = talloc_chunk_from_ptr(ptr);\n\n\tif (unlikely(tc->refs != NULL)) {\n\t\tstruct talloc_reference_handle *h;\n\n\t\tif (talloc_parent(ptr) == null_context && tc->refs->next == NULL) {\n\t\t\t/* in this case we do know which parent should\n\t\t\t   get this pointer, as there is really only\n\t\t\t   one parent */\n\t\t\treturn talloc_unlink(null_context, ptr);\n\t\t}\n\n\t\ttalloc_log(\"ERROR: talloc_free with references at %s\\n\",\n\t\t\t   location);\n\n\t\tfor (h=tc->refs; h; h=h->next) {\n\t\t\ttalloc_log(\"\\treference at %s\\n\",\n\t\t\t\t   h->location);\n\t\t}\n\t\treturn -1;\n\t}\n\n\treturn _talloc_free_internal(ptr, location);\n}\n\n\n\n/*\n  A talloc version of realloc. The context argument is only used if\n  ptr is NULL\n*/\n_PUBLIC_ void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *name)\n{\n\tstruct talloc_chunk *tc;\n\tvoid *new_ptr;\n\tbool malloced = false;\n\tstruct talloc_pool_hdr *pool_hdr = NULL;\n\tsize_t old_size = 0;\n\tsize_t new_size = 0;\n\n\t/* size zero is equivalent to free() */\n\tif (unlikely(size == 0)) {\n\t\ttalloc_unlink(context, ptr);\n\t\treturn NULL;\n\t}\n\n\tif (unlikely(size >= MAX_TALLOC_SIZE)) {\n\t\treturn NULL;\n\t}\n\n\t/* realloc(NULL) is equivalent to malloc() */\n\tif (ptr == NULL) {\n\t\treturn _talloc_named_const(context, size, name);\n\t}\n\n\ttc = talloc_chunk_from_ptr(ptr);\n\n\t/* don't allow realloc on referenced pointers */\n\tif (unlikely(tc->refs)) {\n\t\treturn NULL;\n\t}\n\n\t/* don't let anybody try to realloc a talloc_pool */\n\tif (unlikely(tc->flags & TALLOC_FLAG_POOL)) {\n\t\treturn NULL;\n\t}\n\n\t/* handle realloc inside a talloc_pool */\n\tif (unlikely(tc->flags & TALLOC_FLAG_POOLMEM)) {\n\t\tpool_hdr = tc->pool;\n\t}\n\n\t/* don't shrink if we have less than 1k to gain */\n\tif (size < tc->size && tc->limit == NULL) {\n\t\tif (pool_hdr) {\n\t\t\tvoid *next_tc = tc_next_chunk(tc);\n\t\t\tTC_INVALIDATE_SHRINK_CHUNK(tc, size);\n\t\t\ttc->size = size;\n\t\t\tif (next_tc == pool_hdr->end) {\n\t\t\t\t/* note: tc->size has changed, so this works */\n\t\t\t\tpool_hdr->end = tc_next_chunk(tc);\n\t\t\t}\n\t\t\treturn ptr;\n\t\t} else if ((tc->size - size) < 1024) {\n\t\t\t/*\n\t\t\t * if we call TC_INVALIDATE_SHRINK_CHUNK() here\n\t\t\t * we would need to call TC_UNDEFINE_GROW_CHUNK()\n\t\t\t * after each realloc call, which slows down\n\t\t\t * testing a lot :-(.\n\t\t\t *\n\t\t\t * That is why we only mark memory as undefined here.\n\t\t\t */\n\t\t\tTC_UNDEFINE_SHRINK_CHUNK(tc, size);\n\n\t\t\t/* do not shrink if we have less than 1k to gain */\n\t\t\ttc->size = size;\n\t\t\treturn ptr;\n\t\t}\n\t} else if (tc->size == size) {\n\t\t/*\n\t\t * do not change the pointer if it is exactly\n\t\t * the same size.\n\t\t */\n\t\treturn ptr;\n\t}\n\n\t/*\n\t * by resetting magic we catch users of the old memory\n\t *\n\t * We mark this memory as free, and also over-stamp the talloc\n\t * magic with the old-style magic.\n\t *\n\t * Why?  This tries to avoid a memory read use-after-free from\n\t * disclosing our talloc magic, which would then allow an\n\t * attacker to prepare a valid header and so run a destructor.\n\t *\n\t * What else?  We have to re-stamp back a valid normal magic\n\t * on this memory once realloc() is done, as it will have done\n\t * a memcpy() into the new valid memory.  We can't do this in\n\t * reverse as that would be a real use-after-free.\n\t */\n\t_talloc_chunk_set_free(tc, NULL);\n\n\tif (pool_hdr) {\n\t\tstruct talloc_chunk *pool_tc;\n\t\tvoid *next_tc = tc_next_chunk(tc);\n\t\tsize_t old_chunk_size = TC_ALIGN16(TC_HDR_SIZE + tc->size);\n\t\tsize_t new_chunk_size = TC_ALIGN16(TC_HDR_SIZE + size);\n\t\tsize_t space_needed;\n\t\tsize_t space_left;\n\t\tunsigned int chunk_count = pool_hdr->object_count;\n\n\t\tpool_tc = talloc_chunk_from_pool(pool_hdr);\n\t\tif (!(pool_tc->flags & TALLOC_FLAG_FREE)) {\n\t\t\tchunk_count -= 1;\n\t\t}\n\n\t\tif (chunk_count == 1) {\n\t\t\t/*\n\t\t\t * optimize for the case where 'tc' is the only\n\t\t\t * chunk in the pool.\n\t\t\t */\n\t\t\tchar *start = tc_pool_first_chunk(pool_hdr);\n\t\t\tspace_needed = new_chunk_size;\n\t\t\tspace_left = (char *)tc_pool_end(pool_hdr) - start;\n\n\t\t\tif (space_left >= space_needed) {\n\t\t\t\tsize_t old_used = TC_HDR_SIZE + tc->size;\n\t\t\t\tsize_t new_used = TC_HDR_SIZE + size;\n\t\t\t\tnew_ptr = start;\n\n#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_UNDEFINED)\n\t\t\t\t{\n\t\t\t\t\t/*\n\t\t\t\t\t * The area from\n\t\t\t\t\t * start -> tc may have\n\t\t\t\t\t * been freed and thus been marked as\n\t\t\t\t\t * VALGRIND_MEM_NOACCESS. Set it to\n\t\t\t\t\t * VALGRIND_MEM_UNDEFINED so we can\n\t\t\t\t\t * copy into it without valgrind errors.\n\t\t\t\t\t * We can't just mark\n\t\t\t\t\t * new_ptr -> new_ptr + old_used\n\t\t\t\t\t * as this may overlap on top of tc,\n\t\t\t\t\t * (which is why we use memmove, not\n\t\t\t\t\t * memcpy below) hence the MIN.\n\t\t\t\t\t */\n\t\t\t\t\tsize_t undef_len = MIN((((char *)tc) - ((char *)new_ptr)),old_used);\n\t\t\t\t\tVALGRIND_MAKE_MEM_UNDEFINED(new_ptr, undef_len);\n\t\t\t\t}\n#endif\n\n\t\t\t\tmemmove(new_ptr, tc, old_used);\n\n\t\t\t\ttc = (struct talloc_chunk *)new_ptr;\n\t\t\t\tTC_UNDEFINE_GROW_CHUNK(tc, size);\n\n\t\t\t\t/*\n\t\t\t\t * first we do not align the pool pointer\n\t\t\t\t * because we want to invalidate the padding\n\t\t\t\t * too.\n\t\t\t\t */\n\t\t\t\tpool_hdr->end = new_used + (char *)new_ptr;\n\t\t\t\ttc_invalidate_pool(pool_hdr);\n\n\t\t\t\t/* now the aligned pointer */\n\t\t\t\tpool_hdr->end = new_chunk_size + (char *)new_ptr;\n\t\t\t\tgoto got_new_ptr;\n\t\t\t}\n\n\t\t\tnext_tc = NULL;\n\t\t}\n\n\t\tif (new_chunk_size == old_chunk_size) {\n\t\t\tTC_UNDEFINE_GROW_CHUNK(tc, size);\n\t\t\t_talloc_chunk_set_not_free(tc);\n\t\t\ttc->size = size;\n\t\t\treturn ptr;\n\t\t}\n\n\t\tif (next_tc == pool_hdr->end) {\n\t\t\t/*\n\t\t\t * optimize for the case where 'tc' is the last\n\t\t\t * chunk in the pool.\n\t\t\t */\n\t\t\tspace_needed = new_chunk_size - old_chunk_size;\n\t\t\tspace_left = tc_pool_space_left(pool_hdr);\n\n\t\t\tif (space_left >= space_needed) {\n\t\t\t\tTC_UNDEFINE_GROW_CHUNK(tc, size);\n\t\t\t\t_talloc_chunk_set_not_free(tc);\n\t\t\t\ttc->size = size;\n\t\t\t\tpool_hdr->end = tc_next_chunk(tc);\n\t\t\t\treturn ptr;\n\t\t\t}\n\t\t}\n\n\t\tnew_ptr = tc_alloc_pool(tc, size + TC_HDR_SIZE, 0);\n\n\t\tif (new_ptr == NULL) {\n\t\t\t/*\n\t\t\t * Couldn't allocate from pool (pool size\n\t\t\t * counts as already allocated for memlimit\n\t\t\t * purposes). We must check memory limit\n\t\t\t * before any real malloc.\n\t\t\t */\n\t\t\tif (tc->limit) {\n\t\t\t\t/*\n\t\t\t\t * Note we're doing an extra malloc,\n\t\t\t\t * on top of the pool size, so account\n\t\t\t\t * for size only, not the difference\n\t\t\t\t * between old and new size.\n\t\t\t\t */\n\t\t\t\tif (!talloc_memlimit_check(tc->limit, size)) {\n\t\t\t\t\t_talloc_chunk_set_not_free(tc);\n\t\t\t\t\terrno = ENOMEM;\n\t\t\t\t\treturn NULL;\n\t\t\t\t}\n\t\t\t}\n\t\t\tnew_ptr = malloc(TC_HDR_SIZE+size);\n\t\t\tmalloced = true;\n\t\t\tnew_size = size;\n\t\t}\n\n\t\tif (new_ptr) {\n\t\t\tmemcpy(new_ptr, tc, MIN(tc->size,size) + TC_HDR_SIZE);\n\n\t\t\t_tc_free_poolmem(tc, __location__ \"_talloc_realloc\");\n\t\t}\n\t}\n\telse {\n\t\t/* We're doing realloc here, so record the difference. */\n\t\told_size = tc->size;\n\t\tnew_size = size;\n\t\t/*\n\t\t * We must check memory limit\n\t\t * before any real realloc.\n\t\t */\n\t\tif (tc->limit && (size > old_size)) {\n\t\t\tif (!talloc_memlimit_check(tc->limit,\n\t\t\t\t\t(size - old_size))) {\n\t\t\t\t_talloc_chunk_set_not_free(tc);\n\t\t\t\terrno = ENOMEM;\n\t\t\t\treturn NULL;\n\t\t\t}\n\t\t}\n\t\tnew_ptr = realloc(tc, size + TC_HDR_SIZE);\n\t}\ngot_new_ptr:\n\n\tif (unlikely(!new_ptr)) {\n\t\t/*\n\t\t * Ok, this is a strange spot.  We have to put back\n\t\t * the old talloc_magic and any flags, except the\n\t\t * TALLOC_FLAG_FREE as this was not free'ed by the\n\t\t * realloc() call after all\n\t\t */\n\t\t_talloc_chunk_set_not_free(tc);\n\t\treturn NULL;\n\t}\n\n\t/*\n\t * tc is now the new value from realloc(), the old memory we\n\t * can't access any more and was preemptively marked as\n\t * TALLOC_FLAG_FREE before the call.  Now we mark it as not\n\t * free again\n\t */\n\ttc = (struct talloc_chunk *)new_ptr;\n\t_talloc_chunk_set_not_free(tc);\n\tif (malloced) {\n\t\ttc->flags &= ~TALLOC_FLAG_POOLMEM;\n\t}\n\tif (tc->parent) {\n\t\ttc->parent->child = tc;\n\t}\n\tif (tc->child) {\n\t\ttc->child->parent = tc;\n\t}\n\n\tif (tc->prev) {\n\t\ttc->prev->next = tc;\n\t}\n\tif (tc->next) {\n\t\ttc->next->prev = tc;\n\t}\n\n\tif (new_size > old_size) {\n\t\ttalloc_memlimit_grow(tc->limit, new_size - old_size);\n\t} else if (new_size < old_size) {\n\t\ttalloc_memlimit_shrink(tc->limit, old_size - new_size);\n\t}\n\n\ttc->size = size;\n\t_tc_set_name_const(tc, name);\n\n\treturn TC_PTR_FROM_CHUNK(tc);\n}\n\n/*\n  a wrapper around talloc_steal() for situations where you are moving a pointer\n  between two structures, and want the old pointer to be set to NULL\n*/\n_PUBLIC_ void *_talloc_move(const void *new_ctx, const void *_pptr)\n{\n\tconst void **pptr = discard_const_p(const void *,_pptr);\n\tvoid *ret = talloc_steal(new_ctx, discard_const_p(void, *pptr));\n\t(*pptr) = NULL;\n\treturn ret;\n}\n\nenum talloc_mem_count_type {\n\tTOTAL_MEM_SIZE,\n\tTOTAL_MEM_BLOCKS,\n\tTOTAL_MEM_LIMIT,\n};\n\nstatic inline size_t _talloc_total_mem_internal(const void *ptr,\n\t\t\t\t\t enum talloc_mem_count_type type,\n\t\t\t\t\t struct talloc_memlimit *old_limit,\n\t\t\t\t\t struct talloc_memlimit *new_limit)\n{\n\tsize_t total = 0;\n\tstruct talloc_chunk *c, *tc;\n\n\tif (ptr == NULL) {\n\t\tptr = null_context;\n\t}\n\tif (ptr == NULL) {\n\t\treturn 0;\n\t}\n\n\ttc = talloc_chunk_from_ptr(ptr);\n\n\tif (old_limit || new_limit) {\n\t\tif (tc->limit && tc->limit->upper == old_limit) {\n\t\t\ttc->limit->upper = new_limit;\n\t\t}\n\t}\n\n\t/* optimize in the memlimits case */\n\tif (type == TOTAL_MEM_LIMIT &&\n\t    tc->limit != NULL &&\n\t    tc->limit != old_limit &&\n\t    tc->limit->parent == tc) {\n\t\treturn tc->limit->cur_size;\n\t}\n\n\tif (tc->flags & TALLOC_FLAG_LOOP) {\n\t\treturn 0;\n\t}\n\n\ttc->flags |= TALLOC_FLAG_LOOP;\n\n\tif (old_limit || new_limit) {\n\t\tif (old_limit == tc->limit) {\n\t\t\ttc->limit = new_limit;\n\t\t}\n\t}\n\n\tswitch (type) {\n\tcase TOTAL_MEM_SIZE:\n\t\tif (likely(tc->name != TALLOC_MAGIC_REFERENCE)) {\n\t\t\ttotal = tc->size;\n\t\t}\n\t\tbreak;\n\tcase TOTAL_MEM_BLOCKS:\n\t\ttotal++;\n\t\tbreak;\n\tcase TOTAL_MEM_LIMIT:\n\t\tif (likely(tc->name != TALLOC_MAGIC_REFERENCE)) {\n\t\t\t/*\n\t\t\t * Don't count memory allocated from a pool\n\t\t\t * when calculating limits. Only count the\n\t\t\t * pool itself.\n\t\t\t */\n\t\t\tif (!(tc->flags & TALLOC_FLAG_POOLMEM)) {\n\t\t\t\tif (tc->flags & TALLOC_FLAG_POOL) {\n\t\t\t\t\t/*\n\t\t\t\t\t * If this is a pool, the allocated\n\t\t\t\t\t * size is in the pool header, and\n\t\t\t\t\t * remember to add in the prefix\n\t\t\t\t\t * length.\n\t\t\t\t\t */\n\t\t\t\t\tstruct talloc_pool_hdr *pool_hdr\n\t\t\t\t\t\t\t= talloc_pool_from_chunk(tc);\n\t\t\t\t\ttotal = pool_hdr->poolsize +\n\t\t\t\t\t\t\tTC_HDR_SIZE +\n\t\t\t\t\t\t\tTP_HDR_SIZE;\n\t\t\t\t} else {\n\t\t\t\t\ttotal = tc->size + TC_HDR_SIZE;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tbreak;\n\t}\n\tfor (c = tc->child; c; c = c->next) {\n\t\ttotal += _talloc_total_mem_internal(TC_PTR_FROM_CHUNK(c), type,\n\t\t\t\t\t\t    old_limit, new_limit);\n\t}\n\n\ttc->flags &= ~TALLOC_FLAG_LOOP;\n\n\treturn total;\n}\n\n/*\n  return the total size of a talloc pool (subtree)\n*/\n_PUBLIC_ size_t talloc_total_size(const void *ptr)\n{\n\treturn _talloc_total_mem_internal(ptr, TOTAL_MEM_SIZE, NULL, NULL);\n}\n\n/*\n  return the total number of blocks in a talloc pool (subtree)\n*/\n_PUBLIC_ size_t talloc_total_blocks(const void *ptr)\n{\n\treturn _talloc_total_mem_internal(ptr, TOTAL_MEM_BLOCKS, NULL, NULL);\n}\n\n/*\n  return the number of external references to a pointer\n*/\n_PUBLIC_ size_t talloc_reference_count(const void *ptr)\n{\n\tstruct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);\n\tstruct talloc_reference_handle *h;\n\tsize_t ret = 0;\n\n\tfor (h=tc->refs;h;h=h->next) {\n\t\tret++;\n\t}\n\treturn ret;\n}\n\n/*\n  report on memory usage by all children of a pointer, giving a full tree view\n*/\n_PUBLIC_ void talloc_report_depth_cb(const void *ptr, int depth, int max_depth,\n\t\t\t    void (*callback)(const void *ptr,\n\t\t\t  \t\t     int depth, int max_depth,\n\t\t\t\t\t     int is_ref,\n\t\t\t\t\t     void *private_data),\n\t\t\t    void *private_data)\n{\n\tstruct talloc_chunk *c, *tc;\n\n\tif (ptr == NULL) {\n\t\tptr = null_context;\n\t}\n\tif (ptr == NULL) return;\n\n\ttc = talloc_chunk_from_ptr(ptr);\n\n\tif (tc->flags & TALLOC_FLAG_LOOP) {\n\t\treturn;\n\t}\n\n\tcallback(ptr, depth, max_depth, 0, private_data);\n\n\tif (max_depth >= 0 && depth >= max_depth) {\n\t\treturn;\n\t}\n\n\ttc->flags |= TALLOC_FLAG_LOOP;\n\tfor (c=tc->child;c;c=c->next) {\n\t\tif (c->name == TALLOC_MAGIC_REFERENCE) {\n\t\t\tstruct talloc_reference_handle *h = (struct talloc_reference_handle *)TC_PTR_FROM_CHUNK(c);\n\t\t\tcallback(h->ptr, depth + 1, max_depth, 1, private_data);\n\t\t} else {\n\t\t\ttalloc_report_depth_cb(TC_PTR_FROM_CHUNK(c), depth + 1, max_depth, callback, private_data);\n\t\t}\n\t}\n\ttc->flags &= ~TALLOC_FLAG_LOOP;\n}\n\nstatic void talloc_report_depth_FILE_helper(const void *ptr, int depth, int max_depth, int is_ref, void *_f)\n{\n\tconst char *name = __talloc_get_name(ptr);\n\tstruct talloc_chunk *tc;\n\tFILE *f = (FILE *)_f;\n\n\tif (is_ref) {\n\t\tfprintf(f, \"%*sreference to: %s\\n\", depth*4, \"\", name);\n\t\treturn;\n\t}\n\n\ttc = talloc_chunk_from_ptr(ptr);\n\tif (tc->limit && tc->limit->parent == tc) {\n\t\tfprintf(f, \"%*s%-30s is a memlimit context\"\n\t\t\t\" (max_size = %lu bytes, cur_size = %lu bytes)\\n\",\n\t\t\tdepth*4, \"\",\n\t\t\tname,\n\t\t\t(unsigned long)tc->limit->max_size,\n\t\t\t(unsigned long)tc->limit->cur_size);\n\t}\n\n\tif (depth == 0) {\n\t\tfprintf(f,\"%stalloc report on '%s' (total %6lu bytes in %3lu blocks)\\n\",\n\t\t\t(max_depth < 0 ? \"full \" :\"\"), name,\n\t\t\t(unsigned long)talloc_total_size(ptr),\n\t\t\t(unsigned long)talloc_total_blocks(ptr));\n\t\treturn;\n\t}\n\n\tfprintf(f, \"%*s%-30s contains %6lu bytes in %3lu blocks (ref %d) %p\\n\",\n\t\tdepth*4, \"\",\n\t\tname,\n\t\t(unsigned long)talloc_total_size(ptr),\n\t\t(unsigned long)talloc_total_blocks(ptr),\n\t\t(int)talloc_reference_count(ptr), ptr);\n\n#if 0\n\tfprintf(f, \"content: \");\n\tif (talloc_total_size(ptr)) {\n\t\tint tot = talloc_total_size(ptr);\n\t\tint i;\n\n\t\tfor (i = 0; i < tot; i++) {\n\t\t\tif ((((char *)ptr)[i] > 31) && (((char *)ptr)[i] < 126)) {\n\t\t\t\tfprintf(f, \"%c\", ((char *)ptr)[i]);\n\t\t\t} else {\n\t\t\t\tfprintf(f, \"~%02x\", ((char *)ptr)[i]);\n\t\t\t}\n\t\t}\n\t}\n\tfprintf(f, \"\\n\");\n#endif\n}\n\n/*\n  report on memory usage by all children of a pointer, giving a full tree view\n*/\n_PUBLIC_ void talloc_report_depth_file(const void *ptr, int depth, int max_depth, FILE *f)\n{\n\tif (f) {\n\t\ttalloc_report_depth_cb(ptr, depth, max_depth, talloc_report_depth_FILE_helper, f);\n\t\tfflush(f);\n\t}\n}\n\n/*\n  report on memory usage by all children of a pointer, giving a full tree view\n*/\n_PUBLIC_ void talloc_report_full(const void *ptr, FILE *f)\n{\n\ttalloc_report_depth_file(ptr, 0, -1, f);\n}\n\n/*\n  report on memory usage by all children of a pointer\n*/\n_PUBLIC_ void talloc_report(const void *ptr, FILE *f)\n{\n\ttalloc_report_depth_file(ptr, 0, 1, f);\n}\n\n/*\n  enable tracking of the NULL context\n*/\n_PUBLIC_ void talloc_enable_null_tracking(void)\n{\n\tif (null_context == NULL) {\n\t\tnull_context = _talloc_named_const(NULL, 0, \"null_context\");\n\t\tif (autofree_context != NULL) {\n\t\t\ttalloc_reparent(NULL, null_context, autofree_context);\n\t\t}\n\t}\n}\n\n/*\n  enable tracking of the NULL context, not moving the autofree context\n  into the NULL context. This is needed for the talloc testsuite\n*/\n_PUBLIC_ void talloc_enable_null_tracking_no_autofree(void)\n{\n\tif (null_context == NULL) {\n\t\tnull_context = _talloc_named_const(NULL, 0, \"null_context\");\n\t}\n}\n\n/*\n  disable tracking of the NULL context\n*/\n_PUBLIC_ void talloc_disable_null_tracking(void)\n{\n\tif (null_context != NULL) {\n\t\t/* we have to move any children onto the real NULL\n\t\t   context */\n\t\tstruct talloc_chunk *tc, *tc2;\n\t\ttc = talloc_chunk_from_ptr(null_context);\n\t\tfor (tc2 = tc->child; tc2; tc2=tc2->next) {\n\t\t\tif (tc2->parent == tc) tc2->parent = NULL;\n\t\t\tif (tc2->prev == tc) tc2->prev = NULL;\n\t\t}\n\t\tfor (tc2 = tc->next; tc2; tc2=tc2->next) {\n\t\t\tif (tc2->parent == tc) tc2->parent = NULL;\n\t\t\tif (tc2->prev == tc) tc2->prev = NULL;\n\t\t}\n\t\ttc->child = NULL;\n\t\ttc->next = NULL;\n\t}\n\ttalloc_free(null_context);\n\tnull_context = NULL;\n}\n\n/*\n  enable leak reporting on exit\n*/\n_PUBLIC_ void talloc_enable_leak_report(void)\n{\n\ttalloc_enable_null_tracking();\n\ttalloc_report_null = true;\n\ttalloc_setup_atexit();\n}\n\n/*\n  enable full leak reporting on exit\n*/\n_PUBLIC_ void talloc_enable_leak_report_full(void)\n{\n\ttalloc_enable_null_tracking();\n\ttalloc_report_null_full = true;\n\ttalloc_setup_atexit();\n}\n\n/*\n   talloc and zero memory.\n*/\n_PUBLIC_ void *_talloc_zero(const void *ctx, size_t size, const char *name)\n{\n\tvoid *p = _talloc_named_const(ctx, size, name);\n\n\tif (p) {\n\t\tmemset(p, '\\0', size);\n\t}\n\n\treturn p;\n}\n\n/*\n  memdup with a talloc.\n*/\n_PUBLIC_ void *_talloc_memdup(const void *t, const void *p, size_t size, const char *name)\n{\n\tvoid *newp = NULL;\n\n\tif (likely(size > 0) && unlikely(p == NULL)) {\n\t\treturn NULL;\n\t}\n\n\tnewp = _talloc_named_const(t, size, name);\n\tif (likely(newp != NULL) && likely(size > 0)) {\n\t\tmemcpy(newp, p, size);\n\t}\n\n\treturn newp;\n}\n\nstatic inline char *__talloc_strlendup(const void *t, const char *p, size_t len)\n{\n\tchar *ret;\n\tstruct talloc_chunk *tc = NULL;\n\n\tret = (char *)__talloc(t, len + 1, &tc);\n\tif (unlikely(!ret)) return NULL;\n\n\tmemcpy(ret, p, len);\n\tret[len] = 0;\n\n\t_tc_set_name_const(tc, ret);\n\treturn ret;\n}\n\n/*\n  strdup with a talloc\n*/\n_PUBLIC_ char *talloc_strdup(const void *t, const char *p)\n{\n\tif (unlikely(!p)) return NULL;\n\treturn __talloc_strlendup(t, p, strlen(p));\n}\n\n/*\n  strndup with a talloc\n*/\n_PUBLIC_ char *talloc_strndup(const void *t, const char *p, size_t n)\n{\n\tif (unlikely(!p)) return NULL;\n\treturn __talloc_strlendup(t, p, strnlen(p, n));\n}\n\nstatic inline char *__talloc_strlendup_append(char *s, size_t slen,\n\t\t\t\t\t      const char *a, size_t alen)\n{\n\tchar *ret;\n\n\tret = talloc_realloc(NULL, s, char, slen + alen + 1);\n\tif (unlikely(!ret)) return NULL;\n\n\t/* append the string and the trailing \\0 */\n\tmemcpy(&ret[slen], a, alen);\n\tret[slen+alen] = 0;\n\n\t_tc_set_name_const(talloc_chunk_from_ptr(ret), ret);\n\treturn ret;\n}\n\n/*\n * Appends at the end of the string.\n */\n_PUBLIC_ char *talloc_strdup_append(char *s, const char *a)\n{\n\tif (unlikely(!s)) {\n\t\treturn talloc_strdup(NULL, a);\n\t}\n\n\tif (unlikely(!a)) {\n\t\treturn s;\n\t}\n\n\treturn __talloc_strlendup_append(s, strlen(s), a, strlen(a));\n}\n\n/*\n * Appends at the end of the talloc'ed buffer,\n * not the end of the string.\n */\n_PUBLIC_ char *talloc_strdup_append_buffer(char *s, const char *a)\n{\n\tsize_t slen;\n\n\tif (unlikely(!s)) {\n\t\treturn talloc_strdup(NULL, a);\n\t}\n\n\tif (unlikely(!a)) {\n\t\treturn s;\n\t}\n\n\tslen = talloc_get_size(s);\n\tif (likely(slen > 0)) {\n\t\tslen--;\n\t}\n\n\treturn __talloc_strlendup_append(s, slen, a, strlen(a));\n}\n\n/*\n * Appends at the end of the string.\n */\n_PUBLIC_ char *talloc_strndup_append(char *s, const char *a, size_t n)\n{\n\tif (unlikely(!s)) {\n\t\treturn talloc_strndup(NULL, a, n);\n\t}\n\n\tif (unlikely(!a)) {\n\t\treturn s;\n\t}\n\n\treturn __talloc_strlendup_append(s, strlen(s), a, strnlen(a, n));\n}\n\n/*\n * Appends at the end of the talloc'ed buffer,\n * not the end of the string.\n */\n_PUBLIC_ char *talloc_strndup_append_buffer(char *s, const char *a, size_t n)\n{\n\tsize_t slen;\n\n\tif (unlikely(!s)) {\n\t\treturn talloc_strndup(NULL, a, n);\n\t}\n\n\tif (unlikely(!a)) {\n\t\treturn s;\n\t}\n\n\tslen = talloc_get_size(s);\n\tif (likely(slen > 0)) {\n\t\tslen--;\n\t}\n\n\treturn __talloc_strlendup_append(s, slen, a, strnlen(a, n));\n}\n\n#ifndef HAVE_VA_COPY\n#ifdef HAVE___VA_COPY\n#define va_copy(dest, src) __va_copy(dest, src)\n#else\n#define va_copy(dest, src) (dest) = (src)\n#endif\n#endif\n\nstatic struct talloc_chunk *_vasprintf_tc(const void *t,\n\t\t\t\t\t  const char *fmt,\n\t\t\t\t\t  va_list ap) PRINTF_ATTRIBUTE(2,0);\n\nstatic struct talloc_chunk *_vasprintf_tc(const void *t,\n\t\t\t\t\t  const char *fmt,\n\t\t\t\t\t  va_list ap)\n{\n\tint vlen;\n\tsize_t len;\n\tchar *ret;\n\tva_list ap2;\n\tstruct talloc_chunk *tc = NULL;\n\tchar buf[1024];\n\n\tva_copy(ap2, ap);\n\tvlen = vsnprintf(buf, sizeof(buf), fmt, ap2);\n\tva_end(ap2);\n\tif (unlikely(vlen < 0)) {\n\t\treturn NULL;\n\t}\n\tlen = vlen;\n\tif (unlikely(len + 1 < len)) {\n\t\treturn NULL;\n\t}\n\n\tret = (char *)__talloc(t, len+1, &tc);\n\tif (unlikely(!ret)) return NULL;\n\n\tif (len < sizeof(buf)) {\n\t\tmemcpy(ret, buf, len+1);\n\t} else {\n\t\tva_copy(ap2, ap);\n\t\tvsnprintf(ret, len+1, fmt, ap2);\n\t\tva_end(ap2);\n\t}\n\n\t_tc_set_name_const(tc, ret);\n\treturn tc;\n}\n\n_PUBLIC_ char *talloc_vasprintf(const void *t, const char *fmt, va_list ap)\n{\n\tstruct talloc_chunk *tc = _vasprintf_tc(t, fmt, ap);\n\tif (tc == NULL) {\n\t\treturn NULL;\n\t}\n\treturn TC_PTR_FROM_CHUNK(tc);\n}\n\n\n/*\n  Perform string formatting, and return a pointer to newly allocated\n  memory holding the result, inside a memory pool.\n */\n_PUBLIC_ char *talloc_asprintf(const void *t, const char *fmt, ...)\n{\n\tva_list ap;\n\tchar *ret;\n\n\tva_start(ap, fmt);\n\tret = talloc_vasprintf(t, fmt, ap);\n\tva_end(ap);\n\treturn ret;\n}\n\nstatic inline char *__talloc_vaslenprintf_append(char *s, size_t slen,\n\t\t\t\t\t\t const char *fmt, va_list ap)\n\t\t\t\t\t\t PRINTF_ATTRIBUTE(3,0);\n\nstatic inline char *__talloc_vaslenprintf_append(char *s, size_t slen,\n\t\t\t\t\t\t const char *fmt, va_list ap)\n{\n\tssize_t alen;\n\tva_list ap2;\n\tchar c;\n\n\tva_copy(ap2, ap);\n\t/* this call looks strange, but it makes it work on older solaris boxes */\n\talen = vsnprintf(&c, 1, fmt, ap2);\n\tva_end(ap2);\n\n\tif (alen <= 0) {\n\t\t/* Either the vsnprintf failed or the format resulted in\n\t\t * no characters being formatted. In the former case, we\n\t\t * ought to return NULL, in the latter we ought to return\n\t\t * the original string. Most current callers of this\n\t\t * function expect it to never return NULL.\n\t\t */\n\t\treturn s;\n\t}\n\n\ts = talloc_realloc(NULL, s, char, slen + alen + 1);\n\tif (!s) return NULL;\n\n\tvsnprintf(s + slen, alen + 1, fmt, ap);\n\n\t_tc_set_name_const(talloc_chunk_from_ptr(s), s);\n\treturn s;\n}\n\n/**\n * Realloc @p s to append the formatted result of @p fmt and @p ap,\n * and return @p s, which may have moved.  Good for gradually\n * accumulating output into a string buffer. Appends at the end\n * of the string.\n **/\n_PUBLIC_ char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap)\n{\n\tif (unlikely(!s)) {\n\t\treturn talloc_vasprintf(NULL, fmt, ap);\n\t}\n\n\treturn __talloc_vaslenprintf_append(s, strlen(s), fmt, ap);\n}\n\n/**\n * Realloc @p s to append the formatted result of @p fmt and @p ap,\n * and return @p s, which may have moved. Always appends at the\n * end of the talloc'ed buffer, not the end of the string.\n **/\n_PUBLIC_ char *talloc_vasprintf_append_buffer(char *s, const char *fmt, va_list ap)\n{\n\tsize_t slen;\n\n\tif (unlikely(!s)) {\n\t\treturn talloc_vasprintf(NULL, fmt, ap);\n\t}\n\n\tslen = talloc_get_size(s);\n\tif (likely(slen > 0)) {\n\t\tslen--;\n\t}\n\n\treturn __talloc_vaslenprintf_append(s, slen, fmt, ap);\n}\n\n/*\n  Realloc @p s to append the formatted result of @p fmt and return @p\n  s, which may have moved.  Good for gradually accumulating output\n  into a string buffer.\n */\n_PUBLIC_ char *talloc_asprintf_append(char *s, const char *fmt, ...)\n{\n\tva_list ap;\n\n\tva_start(ap, fmt);\n\ts = talloc_vasprintf_append(s, fmt, ap);\n\tva_end(ap);\n\treturn s;\n}\n\n/*\n  Realloc @p s to append the formatted result of @p fmt and return @p\n  s, which may have moved.  Good for gradually accumulating output\n  into a buffer.\n */\n_PUBLIC_ char *talloc_asprintf_append_buffer(char *s, const char *fmt, ...)\n{\n\tva_list ap;\n\n\tva_start(ap, fmt);\n\ts = talloc_vasprintf_append_buffer(s, fmt, ap);\n\tva_end(ap);\n\treturn s;\n}\n\n/*\n * Function to make string-building simple by handling intermediate\n * realloc failures. See for example commit a37ea9d750e1.\n */\n_PUBLIC_ void talloc_asprintf_addbuf(char **ps, const char *fmt, ...)\n{\n\tva_list ap;\n\tchar *s = *ps;\n\tchar *t = NULL;\n\n\tif (s == NULL) {\n\t\treturn;\n\t}\n\n\tva_start(ap, fmt);\n\tt = talloc_vasprintf_append_buffer(s, fmt, ap);\n\tva_end(ap);\n\n\tif (t == NULL) {\n\t\t/* signal failure to the next caller */\n\t\tTALLOC_FREE(s);\n\t\t*ps = NULL;\n\t} else {\n\t\t*ps = t;\n\t}\n}\n\n/*\n  alloc an array, checking for integer overflow in the array size\n*/\n_PUBLIC_ void *_talloc_array(const void *ctx, size_t el_size, unsigned count, const char *name)\n{\n\tif (count >= MAX_TALLOC_SIZE/el_size) {\n\t\treturn NULL;\n\t}\n\treturn _talloc_named_const(ctx, el_size * count, name);\n}\n\n/*\n  alloc an zero array, checking for integer overflow in the array size\n*/\n_PUBLIC_ void *_talloc_zero_array(const void *ctx, size_t el_size, unsigned count, const char *name)\n{\n\tif (count >= MAX_TALLOC_SIZE/el_size) {\n\t\treturn NULL;\n\t}\n\treturn _talloc_zero(ctx, el_size * count, name);\n}\n\n/*\n  realloc an array, checking for integer overflow in the array size\n*/\n_PUBLIC_ void *_talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name)\n{\n\tif (count >= MAX_TALLOC_SIZE/el_size) {\n\t\treturn NULL;\n\t}\n\treturn _talloc_realloc(ctx, ptr, el_size * count, name);\n}\n\n/*\n * realloc an array, checking for integer overflow in the array size\n * and zero out potential additional memory\n */\n_PUBLIC_ void *_talloc_realloc_array_zero(const void *ctx,\n\t\t\t\t\t  void *ptr,\n\t\t\t\t\t  size_t el_size,\n\t\t\t\t\t  unsigned count,\n\t\t\t\t\t  const char *name)\n{\n\tsize_t existing, newsize;\n\tvoid *newptr = NULL;\n\n\tif (count >= MAX_TALLOC_SIZE / el_size) {\n\t\treturn NULL;\n\t}\n\n\texisting = talloc_get_size(ptr);\n\tnewsize = el_size * count;\n\n\tnewptr = _talloc_realloc(ctx, ptr, newsize, name);\n\tif (newptr == NULL) {\n\t\treturn NULL;\n\t}\n\n\tif (newsize > existing) {\n\t\tsize_t to_zero = newsize - existing;\n\t\tmemset_s(((char *)newptr) + existing, to_zero, 0, to_zero);\n\t}\n\n\treturn newptr;\n}\n\n/*\n  a function version of talloc_realloc(), so it can be passed as a function pointer\n  to libraries that want a realloc function (a realloc function encapsulates\n  all the basic capabilities of an allocation library, which is why this is useful)\n*/\n_PUBLIC_ void *talloc_realloc_fn(const void *context, void *ptr, size_t size)\n{\n\treturn _talloc_realloc(context, ptr, size, NULL);\n}\n\n\nstatic int talloc_autofree_destructor(void *ptr)\n{\n\tautofree_context = NULL;\n\treturn 0;\n}\n\n/*\n  return a context which will be auto-freed on exit\n  this is useful for reducing the noise in leak reports\n*/\n_PUBLIC_ void *talloc_autofree_context(void)\n{\n\tif (autofree_context == NULL) {\n\t\tautofree_context = _talloc_named_const(NULL, 0, \"autofree_context\");\n\t\ttalloc_set_destructor(autofree_context, talloc_autofree_destructor);\n\t\ttalloc_setup_atexit();\n\t}\n\treturn autofree_context;\n}\n\n_PUBLIC_ size_t talloc_get_size(const void *context)\n{\n\tstruct talloc_chunk *tc;\n\n\tif (context == NULL) {\n\t\treturn 0;\n\t}\n\n\ttc = talloc_chunk_from_ptr(context);\n\n\treturn tc->size;\n}\n\n/*\n  find a parent of this context that has the given name, if any\n*/\n_PUBLIC_ void *talloc_find_parent_byname(const void *context, const char *name)\n{\n\tstruct talloc_chunk *tc;\n\n\tif (context == NULL) {\n\t\treturn NULL;\n\t}\n\n\ttc = talloc_chunk_from_ptr(context);\n\twhile (tc) {\n\t\tif (tc->name && strcmp(tc->name, name) == 0) {\n\t\t\treturn TC_PTR_FROM_CHUNK(tc);\n\t\t}\n\t\twhile (tc && tc->prev) tc = tc->prev;\n\t\tif (tc) {\n\t\t\ttc = tc->parent;\n\t\t}\n\t}\n\treturn NULL;\n}\n\n/*\n  show the parentage of a context\n*/\n_PUBLIC_ void talloc_show_parents(const void *context, FILE *file)\n{\n\tstruct talloc_chunk *tc;\n\n\tif (context == NULL) {\n\t\tfprintf(file, \"talloc no parents for NULL\\n\");\n\t\treturn;\n\t}\n\n\ttc = talloc_chunk_from_ptr(context);\n\tfprintf(file, \"talloc parents of '%s'\\n\", __talloc_get_name(context));\n\twhile (tc) {\n\t\tfprintf(file, \"\\t'%s'\\n\", __talloc_get_name(TC_PTR_FROM_CHUNK(tc)));\n\t\twhile (tc && tc->prev) tc = tc->prev;\n\t\tif (tc) {\n\t\t\ttc = tc->parent;\n\t\t}\n\t}\n\tfflush(file);\n}\n\n/*\n  return 1 if ptr is a parent of context\n*/\nstatic int _talloc_is_parent(const void *context, const void *ptr, int depth)\n{\n\tstruct talloc_chunk *tc;\n\n\tif (context == NULL) {\n\t\treturn 0;\n\t}\n\n\ttc = talloc_chunk_from_ptr(context);\n\twhile (tc) {\n\t\tif (depth <= 0) {\n\t\t\treturn 0;\n\t\t}\n\t\tif (TC_PTR_FROM_CHUNK(tc) == ptr) return 1;\n\t\twhile (tc && tc->prev) tc = tc->prev;\n\t\tif (tc) {\n\t\t\ttc = tc->parent;\n\t\t\tdepth--;\n\t\t}\n\t}\n\treturn 0;\n}\n\n/*\n  return 1 if ptr is a parent of context\n*/\n_PUBLIC_ int talloc_is_parent(const void *context, const void *ptr)\n{\n\treturn _talloc_is_parent(context, ptr, TALLOC_MAX_DEPTH);\n}\n\n/*\n  return the total size of memory used by this context and all children\n*/\nstatic inline size_t _talloc_total_limit_size(const void *ptr,\n\t\t\t\t\tstruct talloc_memlimit *old_limit,\n\t\t\t\t\tstruct talloc_memlimit *new_limit)\n{\n\treturn _talloc_total_mem_internal(ptr, TOTAL_MEM_LIMIT,\n\t\t\t\t\t  old_limit, new_limit);\n}\n\nstatic inline bool talloc_memlimit_check(struct talloc_memlimit *limit, size_t size)\n{\n\tstruct talloc_memlimit *l;\n\n\tfor (l = limit; l != NULL; l = l->upper) {\n\t\tif (l->max_size != 0 &&\n\t\t    ((l->max_size <= l->cur_size) ||\n\t\t     (l->max_size - l->cur_size < size))) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/*\n  Update memory limits when freeing a talloc_chunk.\n*/\nstatic void tc_memlimit_update_on_free(struct talloc_chunk *tc)\n{\n\tsize_t limit_shrink_size;\n\n\tif (!tc->limit) {\n\t\treturn;\n\t}\n\n\t/*\n\t * Pool entries don't count. Only the pools\n\t * themselves are counted as part of the memory\n\t * limits. Note that this also takes care of\n\t * nested pools which have both flags\n\t * TALLOC_FLAG_POOLMEM|TALLOC_FLAG_POOL set.\n\t */\n\tif (tc->flags & TALLOC_FLAG_POOLMEM) {\n\t\treturn;\n\t}\n\n\t/*\n\t * If we are part of a memory limited context hierarchy\n\t * we need to subtract the memory used from the counters\n\t */\n\n\tlimit_shrink_size = tc->size+TC_HDR_SIZE;\n\n\t/*\n\t * If we're deallocating a pool, take into\n\t * account the prefix size added for the pool.\n\t */\n\n\tif (tc->flags & TALLOC_FLAG_POOL) {\n\t\tlimit_shrink_size += TP_HDR_SIZE;\n\t}\n\n\ttalloc_memlimit_shrink(tc->limit, limit_shrink_size);\n\n\tif (tc->limit->parent == tc) {\n\t\tfree(tc->limit);\n\t}\n\n\ttc->limit = NULL;\n}\n\n/*\n  Increase memory limit accounting after a malloc/realloc.\n*/\nstatic void talloc_memlimit_grow(struct talloc_memlimit *limit,\n\t\t\t\tsize_t size)\n{\n\tstruct talloc_memlimit *l;\n\n\tfor (l = limit; l != NULL; l = l->upper) {\n\t\tsize_t new_cur_size = l->cur_size + size;\n\t\tif (new_cur_size < l->cur_size) {\n\t\t\ttalloc_abort(\"logic error in talloc_memlimit_grow\\n\");\n\t\t\treturn;\n\t\t}\n\t\tl->cur_size = new_cur_size;\n\t}\n}\n\n/*\n  Decrease memory limit accounting after a free/realloc.\n*/\nstatic void talloc_memlimit_shrink(struct talloc_memlimit *limit,\n\t\t\t\tsize_t size)\n{\n\tstruct talloc_memlimit *l;\n\n\tfor (l = limit; l != NULL; l = l->upper) {\n\t\tif (l->cur_size < size) {\n\t\t\ttalloc_abort(\"logic error in talloc_memlimit_shrink\\n\");\n\t\t\treturn;\n\t\t}\n\t\tl->cur_size = l->cur_size - size;\n\t}\n}\n\n_PUBLIC_ int talloc_set_memlimit(const void *ctx, size_t max_size)\n{\n\tstruct talloc_chunk *tc = talloc_chunk_from_ptr(ctx);\n\tstruct talloc_memlimit *orig_limit;\n\tstruct talloc_memlimit *limit = NULL;\n\n\tif (tc->limit && tc->limit->parent == tc) {\n\t\ttc->limit->max_size = max_size;\n\t\treturn 0;\n\t}\n\torig_limit = tc->limit;\n\n\tlimit = malloc(sizeof(struct talloc_memlimit));\n\tif (limit == NULL) {\n\t\treturn 1;\n\t}\n\tlimit->parent = tc;\n\tlimit->max_size = max_size;\n\tlimit->cur_size = _talloc_total_limit_size(ctx, tc->limit, limit);\n\n\tif (orig_limit) {\n\t\tlimit->upper = orig_limit;\n\t} else {\n\t\tlimit->upper = NULL;\n\t}\n\n\treturn 0;\n}\n"},
                          "roles": ["analysisTarget",
                                    "tracedFile"]}],
           "results": [{"ruleId": "-Wanalyzer-null-dereference",
                        "taxa": [{"id": "476",
                                  "toolComponent": {"name": "cwe"}}],
                        "properties": {"gcc/analyzer/saved_diagnostic/sm": "malloc",
                                       "gcc/analyzer/saved_diagnostic/ploc": {"enode": 558},
                                       "gcc/analyzer/saved_diagnostic/var": "_38",
                                       "gcc/analyzer/saved_diagnostic/sval": "(struct talloc_chunk *)0B",
                                       "gcc/analyzer/saved_diagnostic/state": "null",
                                       "gcc/analyzer/saved_diagnostic/idx": 6,
                                       "gcc/analyzer/pending_diagnostic/kind": "null_deref"},
                        "level": "warning",
                        "message": {"text": "dereference of NULL ‘tc’"},
                        "locations": [{"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                 "uriBaseId": "PWD"},
                                                            "region": {"startLine": 764,
                                                                       "startColumn": 21,
                                                                       "endColumn": 34},
                                                            "contextRegion": {"startLine": 764,
                                                                              "snippet": {"text": "\t\tif (parent->limit != NULL) {\n"}}},
                                       "logicalLocations": [{"index": 0,
                                                             "fullyQualifiedName": "__talloc_with_prefix"}]}],
                        "codeFlows": [{"threadFlows": [{"id": "main",
                                                        "locations": [{"properties": {"gcc/analyzer/checker_event/emission_id": "(1)",
                                                                                      "gcc/analyzer/checker_event/kind": "function_entry"},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 2707,
                                                                                                                    "startColumn": 16,
                                                                                                                    "endColumn": 46},
                                                                                                         "contextRegion": {"startLine": 2707,
                                                                                                                           "snippet": {"text": "_PUBLIC_ char *talloc_vasprintf_append_buffer(char *s, const char *fmt, va_list ap)\n"}}},
                                                                                    "logicalLocations": [{"index": 1,
                                                                                                          "fullyQualifiedName": "talloc_vasprintf_append_buffer.part.0"}],
                                                                                    "message": {"text": "entry to ‘talloc_vasprintf_append_buffer’"}},
                                                                       "kinds": ["enter",
                                                                                 "function"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 1},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(2)",
                                                                                      "gcc/analyzer/checker_event/kind": "call",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 2,
                                                                                                                                 "dst_id": 3}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 2712,
                                                                                                                    "startColumn": 24,
                                                                                                                    "endColumn": 55},
                                                                                                         "contextRegion": {"startLine": 2712,
                                                                                                                           "snippet": {"text": "\t\treturn talloc_vasprintf(NULL, fmt, ap);\n"}}},
                                                                                    "logicalLocations": [{"index": 1,
                                                                                                          "fullyQualifiedName": "talloc_vasprintf_append_buffer.part.0"}],
                                                                                    "message": {"text": "calling ‘talloc_vasprintf’ from ‘talloc_vasprintf_append_buffer’"}},
                                                                       "kinds": ["call",
                                                                                 "function"],
                                                                       "nestingLevel": 1,
                                                                       "executionOrder": 2},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(3)",
                                                                                      "gcc/analyzer/checker_event/kind": "function_entry"},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 2627,
                                                                                                                    "startColumn": 16,
                                                                                                                    "endColumn": 32},
                                                                                                         "contextRegion": {"startLine": 2627,
                                                                                                                           "snippet": {"text": "_PUBLIC_ char *talloc_vasprintf(const void *t, const char *fmt, va_list ap)\n"}}},
                                                                                    "logicalLocations": [{"index": 2,
                                                                                                          "fullyQualifiedName": "talloc_vasprintf"}],
                                                                                    "message": {"text": "entry to ‘talloc_vasprintf’"}},
                                                                       "kinds": ["enter",
                                                                                 "function"],
                                                                       "nestingLevel": 2,
                                                                       "executionOrder": 3},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(4)",
                                                                                      "gcc/analyzer/checker_event/kind": "call",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 794,
                                                                                                                                 "dst_id": 795}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 2629,
                                                                                                                    "startColumn": 35,
                                                                                                                    "endColumn": 60},
                                                                                                         "contextRegion": {"startLine": 2629,
                                                                                                                           "snippet": {"text": "\tstruct talloc_chunk *tc = _vasprintf_tc(t, fmt, ap);\n"}}},
                                                                                    "logicalLocations": [{"index": 2,
                                                                                                          "fullyQualifiedName": "talloc_vasprintf"}],
                                                                                    "message": {"text": "calling ‘_vasprintf_tc’ from ‘talloc_vasprintf’"}},
                                                                       "kinds": ["call",
                                                                                 "function"],
                                                                       "nestingLevel": 2,
                                                                       "executionOrder": 4},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(5)",
                                                                                      "gcc/analyzer/checker_event/kind": "function_entry"},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 2590,
                                                                                                                    "startColumn": 29,
                                                                                                                    "endColumn": 42},
                                                                                                         "contextRegion": {"startLine": 2590,
                                                                                                                           "snippet": {"text": "static struct talloc_chunk *_vasprintf_tc(const void *t,\n"}}},
                                                                                    "logicalLocations": [{"index": 3,
                                                                                                          "fullyQualifiedName": "_vasprintf_tc"}],
                                                                                    "message": {"text": "entry to ‘_vasprintf_tc’"}},
                                                                       "kinds": ["enter",
                                                                                 "function"],
                                                                       "nestingLevel": 3,
                                                                       "executionOrder": 5},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(6)",
                                                                                      "gcc/analyzer/checker_event/kind": "state_change"},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 2598,
                                                                                                                    "startColumn": 30,
                                                                                                                    "endColumn": 32},
                                                                                                         "contextRegion": {"startLine": 2598,
                                                                                                                           "snippet": {"text": "\tstruct talloc_chunk *tc = NULL;\n"}}},
                                                                                    "logicalLocations": [{"index": 3,
                                                                                                          "fullyQualifiedName": "_vasprintf_tc"}],
                                                                                    "message": {"text": "‘tc’ is NULL"}},
                                                                       "kinds": ["release",
                                                                                 "memory"],
                                                                       "nestingLevel": 3,
                                                                       "executionOrder": 6},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(7)",
                                                                                      "gcc/analyzer/checker_event/kind": "start_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 811,
                                                                                                                                 "dst_id": 813}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 2604,
                                                                                                                    "startColumn": 12,
                                                                                                                    "endColumn": 13},
                                                                                                         "contextRegion": {"startLine": 2604,
                                                                                                                           "snippet": {"text": "\tif (unlikely(vlen < 0)) {\n"}}},
                                                                                    "logicalLocations": [{"index": 3,
                                                                                                          "fullyQualifiedName": "_vasprintf_tc"}],
                                                                                    "message": {"text": "following ‘false’ branch..."}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 3,
                                                                       "executionOrder": 7},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(8)",
                                                                                      "gcc/analyzer/checker_event/kind": "end_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 811,
                                                                                                                                 "dst_id": 813}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 2607,
                                                                                                                    "startColumn": 9,
                                                                                                                    "endColumn": 19},
                                                                                                         "contextRegion": {"startLine": 2607,
                                                                                                                           "snippet": {"text": "\tlen = vlen;\n"}}},
                                                                                    "logicalLocations": [{"index": 3,
                                                                                                          "fullyQualifiedName": "_vasprintf_tc"}],
                                                                                    "message": {"text": "...to here"}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 3,
                                                                       "executionOrder": 8},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(9)",
                                                                                      "gcc/analyzer/checker_event/kind": "inlined_call"},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 2612,
                                                                                                                    "startColumn": 23,
                                                                                                                    "endColumn": 24},
                                                                                                         "contextRegion": {"startLine": 2612,
                                                                                                                           "snippet": {"text": "\tret = (char *)__talloc(t, len+1, &tc);\n"}}},
                                                                                    "logicalLocations": [{"index": 3,
                                                                                                          "fullyQualifiedName": "_vasprintf_tc"}],
                                                                                    "message": {"text": "inlined call to ‘__talloc’ from ‘_vasprintf_tc’"}},
                                                                       "kinds": ["call",
                                                                                 "function"],
                                                                       "nestingLevel": 3,
                                                                       "executionOrder": 9},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(10)",
                                                                                      "gcc/analyzer/checker_event/kind": "call",
                                                                                      "gcc/analyzer/checker_event/original_fndecl": {"index": 3,
                                                                                                                                     "fullyQualifiedName": "_vasprintf_tc"},
                                                                                      "gcc/analyzer/checker_event/original_depth": 3,
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 815,
                                                                                                                                 "dst_id": 816}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 825,
                                                                                                                    "startColumn": 16,
                                                                                                                    "endColumn": 58},
                                                                                                         "contextRegion": {"startLine": 825,
                                                                                                                           "snippet": {"text": "\treturn __talloc_with_prefix(context, size, 0, tc);\n"}}},
                                                                                    "logicalLocations": [{"index": 4,
                                                                                                          "fullyQualifiedName": "__talloc"}],
                                                                                    "message": {"text": "calling ‘__talloc_with_prefix’ from ‘_vasprintf_tc’"}},
                                                                       "kinds": ["call",
                                                                                 "function"],
                                                                       "nestingLevel": 4,
                                                                       "executionOrder": 10},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(11)",
                                                                                      "gcc/analyzer/checker_event/kind": "function_entry"},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 739,
                                                                                                                    "startColumn": 21,
                                                                                                                    "endColumn": 41},
                                                                                                         "contextRegion": {"startLine": 739,
                                                                                                                           "snippet": {"text": "static inline void *__talloc_with_prefix(const void *context,\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "__talloc_with_prefix"}],
                                                                                    "message": {"text": "entry to ‘__talloc_with_prefix’"}},
                                                                       "kinds": ["enter",
                                                                                 "function"],
                                                                       "nestingLevel": 4,
                                                                       "executionOrder": 11},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(12)",
                                                                                      "gcc/analyzer/checker_event/kind": "start_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 2565,
                                                                                                                                 "dst_id": 2567}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 749,
                                                                                                                    "startColumn": 12,
                                                                                                                    "endColumn": 13},
                                                                                                         "contextRegion": {"startLine": 749,
                                                                                                                           "snippet": {"text": "\tif (unlikely(context == NULL)) {\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "__talloc_with_prefix"}],
                                                                                    "message": {"text": "following ‘true’ branch..."}},
                                                                       "kinds": ["branch",
                                                                                 "true"],
                                                                       "nestingLevel": 4,
                                                                       "executionOrder": 12},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(13)",
                                                                                      "gcc/analyzer/checker_event/kind": "end_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 2565,
                                                                                                                                 "dst_id": 2567}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 750,
                                                                                                                    "startColumn": 17,
                                                                                                                    "endColumn": 39},
                                                                                                         "contextRegion": {"startLine": 750,
                                                                                                                           "snippet": {"text": "\t\tcontext = null_context;\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "__talloc_with_prefix"}],
                                                                                    "message": {"text": "...to here"}},
                                                                       "kinds": ["branch",
                                                                                 "true"],
                                                                       "nestingLevel": 4,
                                                                       "executionOrder": 13},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(14)",
                                                                                      "gcc/analyzer/checker_event/kind": "start_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 2574,
                                                                                                                                 "dst_id": 2576}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 753,
                                                                                                                    "startColumn": 12,
                                                                                                                    "endColumn": 13},
                                                                                                         "contextRegion": {"startLine": 753,
                                                                                                                           "snippet": {"text": "\tif (unlikely(size >= MAX_TALLOC_SIZE)) {\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "__talloc_with_prefix"}],
                                                                                    "message": {"text": "following ‘false’ branch..."}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 4,
                                                                       "executionOrder": 14},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(15)",
                                                                                      "gcc/analyzer/checker_event/kind": "end_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 2574,
                                                                                                                                 "dst_id": 2576}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 757,
                                                                                                                    "startColumn": 13,
                                                                                                                    "endColumn": 14},
                                                                                                         "contextRegion": {"startLine": 757,
                                                                                                                           "snippet": {"text": "\tif (unlikely(total_len < TC_HDR_SIZE)) {\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "__talloc_with_prefix"}],
                                                                                    "message": {"text": "...to here"},
                                                                                    "id": 0,
                                                                                    "relationships": [{"target": 1,
                                                                                                       "kinds": ["isIncludedBy"]}]},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 4,
                                                                       "executionOrder": 15},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(16)",
                                                                                      "gcc/analyzer/checker_event/kind": "start_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 2579,
                                                                                                                                 "dst_id": 2581}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 757,
                                                                                                                    "startColumn": 12,
                                                                                                                    "endColumn": 13},
                                                                                                         "contextRegion": {"startLine": 757,
                                                                                                                           "snippet": {"text": "\tif (unlikely(total_len < TC_HDR_SIZE)) {\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "__talloc_with_prefix"}],
                                                                                    "message": {"text": "following ‘false’ branch..."}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 4,
                                                                       "executionOrder": 16},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(17)",
                                                                                      "gcc/analyzer/checker_event/kind": "end_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 2579,
                                                                                                                                 "dst_id": 2581}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 761,
                                                                                                                    "startColumn": 13,
                                                                                                                    "endColumn": 14},
                                                                                                         "contextRegion": {"startLine": 761,
                                                                                                                           "snippet": {"text": "\tif (likely(context != NULL)) {\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "__talloc_with_prefix"}],
                                                                                    "message": {"text": "...to here"},
                                                                                    "id": 2,
                                                                                    "relationships": [{"target": 1,
                                                                                                       "kinds": ["isIncludedBy"]}]},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 4,
                                                                       "executionOrder": 17},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(18)",
                                                                                      "gcc/analyzer/checker_event/kind": "start_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 2584,
                                                                                                                                 "dst_id": 2586}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 761,
                                                                                                                    "startColumn": 12,
                                                                                                                    "endColumn": 13},
                                                                                                         "contextRegion": {"startLine": 761,
                                                                                                                           "snippet": {"text": "\tif (likely(context != NULL)) {\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "__talloc_with_prefix"}],
                                                                                    "message": {"text": "following ‘true’ branch..."}},
                                                                       "kinds": ["branch",
                                                                                 "true"],
                                                                       "nestingLevel": 4,
                                                                       "executionOrder": 18},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(19)",
                                                                                      "gcc/analyzer/checker_event/kind": "end_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 2584,
                                                                                                                                 "dst_id": 2586}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 762,
                                                                                                                    "startColumn": 26,
                                                                                                                    "endColumn": 56},
                                                                                                         "contextRegion": {"startLine": 762,
                                                                                                                           "snippet": {"text": "\t\tparent = talloc_chunk_from_ptr(context);\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "__talloc_with_prefix"}],
                                                                                    "message": {"text": "...to here"}},
                                                                       "kinds": ["branch",
                                                                                 "true"],
                                                                       "nestingLevel": 4,
                                                                       "executionOrder": 19},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(20)",
                                                                                      "gcc/analyzer/checker_event/kind": "call",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 2586,
                                                                                                                                 "dst_id": 2587}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 762,
                                                                                                                    "startColumn": 26,
                                                                                                                    "endColumn": 56},
                                                                                                         "contextRegion": {"startLine": 762,
                                                                                                                           "snippet": {"text": "\t\tparent = talloc_chunk_from_ptr(context);\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "__talloc_with_prefix"}],
                                                                                    "message": {"text": "calling ‘talloc_chunk_from_ptr’ from ‘__talloc_with_prefix’"}},
                                                                       "kinds": ["call",
                                                                                 "function"],
                                                                       "nestingLevel": 4,
                                                                       "executionOrder": 20},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(21)",
                                                                                      "gcc/analyzer/checker_event/kind": "function_entry"},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 523,
                                                                                                                    "startColumn": 36,
                                                                                                                    "endColumn": 57},
                                                                                                         "contextRegion": {"startLine": 523,
                                                                                                                           "snippet": {"text": "static inline struct talloc_chunk *talloc_chunk_from_ptr(const void *ptr)\n"}}},
                                                                                    "logicalLocations": [{"index": 5,
                                                                                                          "fullyQualifiedName": "talloc_chunk_from_ptr"}],
                                                                                    "message": {"text": "entry to ‘talloc_chunk_from_ptr’"}},
                                                                       "kinds": ["enter",
                                                                                 "function"],
                                                                       "nestingLevel": 5,
                                                                       "executionOrder": 21},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(22)",
                                                                                      "gcc/analyzer/checker_event/kind": "start_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 2765,
                                                                                                                                 "dst_id": 2767}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 527,
                                                                                                                    "startColumn": 12,
                                                                                                                    "endColumn": 13},
                                                                                                         "contextRegion": {"startLine": 527,
                                                                                                                           "snippet": {"text": "\tif (unlikely((tc->flags & (TALLOC_FLAG_FREE | ~TALLOC_FLAG_MASK)) != talloc_magic)) {\n"}}},
                                                                                    "logicalLocations": [{"index": 5,
                                                                                                          "fullyQualifiedName": "talloc_chunk_from_ptr"}],
                                                                                    "message": {"text": "following ‘true’ branch..."}},
                                                                       "kinds": ["branch",
                                                                                 "true"],
                                                                       "nestingLevel": 5,
                                                                       "executionOrder": 22},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(23)",
                                                                                      "gcc/analyzer/checker_event/kind": "end_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 2765,
                                                                                                                                 "dst_id": 2767}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 528,
                                                                                                                    "startColumn": 20,
                                                                                                                    "endColumn": 21},
                                                                                                         "contextRegion": {"startLine": 528,
                                                                                                                           "snippet": {"text": "\t\tif ((tc->flags & (TALLOC_FLAG_FREE | ~TALLOC_FLAG_MASK))\n"}}},
                                                                                    "logicalLocations": [{"index": 5,
                                                                                                          "fullyQualifiedName": "talloc_chunk_from_ptr"}],
                                                                                    "message": {"text": "...to here"}},
                                                                       "kinds": ["branch",
                                                                                 "true"],
                                                                       "nestingLevel": 5,
                                                                       "executionOrder": 23},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(24)",
                                                                                      "gcc/analyzer/checker_event/kind": "inlined_call"},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 535,
                                                                                                                    "startColumn": 17,
                                                                                                                    "endColumn": 18},
                                                                                                         "contextRegion": {"startLine": 535,
                                                                                                                           "snippet": {"text": "\t\ttalloc_abort_unknown_value();\n"}}},
                                                                                    "logicalLocations": [{"index": 5,
                                                                                                          "fullyQualifiedName": "talloc_chunk_from_ptr"}],
                                                                                    "message": {"text": "inlined call to ‘talloc_abort_unknown_value’ from ‘talloc_chunk_from_ptr’"}},
                                                                       "kinds": ["call",
                                                                                 "function"],
                                                                       "nestingLevel": 5,
                                                                       "executionOrder": 24},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(25)",
                                                                                      "gcc/analyzer/checker_event/kind": "call",
                                                                                      "gcc/analyzer/checker_event/original_fndecl": {"index": 5,
                                                                                                                                     "fullyQualifiedName": "talloc_chunk_from_ptr"},
                                                                                      "gcc/analyzer/checker_event/original_depth": 5,
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 2770,
                                                                                                                                 "dst_id": 2771}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 519,
                                                                                                                    "startColumn": 9,
                                                                                                                    "endColumn": 63},
                                                                                                         "contextRegion": {"startLine": 519,
                                                                                                                           "snippet": {"text": "\ttalloc_abort(\"Bad talloc magic value - unknown value\");\n"}}},
                                                                                    "logicalLocations": [{"index": 6,
                                                                                                          "fullyQualifiedName": "talloc_abort_unknown_value"}],
                                                                                    "message": {"text": "calling ‘talloc_abort’ from ‘talloc_chunk_from_ptr’"}},
                                                                       "kinds": ["call",
                                                                                 "function"],
                                                                       "nestingLevel": 6,
                                                                       "executionOrder": 25},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(26)",
                                                                                      "gcc/analyzer/checker_event/kind": "function_entry"},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 501,
                                                                                                                    "startColumn": 13,
                                                                                                                    "endColumn": 25},
                                                                                                         "contextRegion": {"startLine": 501,
                                                                                                                           "snippet": {"text": "static void talloc_abort(const char *reason)\n"}}},
                                                                                    "logicalLocations": [{"index": 7,
                                                                                                          "fullyQualifiedName": "talloc_abort"}],
                                                                                    "message": {"text": "entry to ‘talloc_abort’"}},
                                                                       "kinds": ["enter",
                                                                                 "function"],
                                                                       "nestingLevel": 6,
                                                                       "executionOrder": 26},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(27)",
                                                                                      "gcc/analyzer/checker_event/kind": "start_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 2780,
                                                                                                                                 "dst_id": 2783}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 505,
                                                                                                                    "startColumn": 12,
                                                                                                                    "endColumn": 13},
                                                                                                         "contextRegion": {"startLine": 505,
                                                                                                                           "snippet": {"text": "\tif (!talloc_abort_fn) {\n"}}},
                                                                                    "logicalLocations": [{"index": 7,
                                                                                                          "fullyQualifiedName": "talloc_abort"}],
                                                                                    "message": {"text": "following ‘false’ branch..."}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 6,
                                                                       "executionOrder": 27},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(28)",
                                                                                      "gcc/analyzer/checker_event/kind": "end_cfg_edge",
                                                                                      "gcc/analyzer/superedge_event/superedge": {"src_id": 2780,
                                                                                                                                 "dst_id": 2783}},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 509,
                                                                                                                    "startColumn": 9,
                                                                                                                    "endColumn": 32},
                                                                                                         "contextRegion": {"startLine": 509,
                                                                                                                           "snippet": {"text": "\ttalloc_abort_fn(reason);\n"}}},
                                                                                    "logicalLocations": [{"index": 7,
                                                                                                          "fullyQualifiedName": "talloc_abort"}],
                                                                                    "message": {"text": "...to here"}},
                                                                       "kinds": ["branch",
                                                                                 "false"],
                                                                       "nestingLevel": 6,
                                                                       "executionOrder": 28},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(29)",
                                                                                      "gcc/analyzer/checker_event/kind": "inlined_call"},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 535,
                                                                                                                    "startColumn": 17,
                                                                                                                    "endColumn": 18},
                                                                                                         "contextRegion": {"startLine": 535,
                                                                                                                           "snippet": {"text": "\t\ttalloc_abort_unknown_value();\n"}}},
                                                                                    "logicalLocations": [{"index": 5,
                                                                                                          "fullyQualifiedName": "talloc_chunk_from_ptr"}],
                                                                                    "message": {"text": "inlined call to ‘talloc_abort_unknown_value’ from ‘talloc_chunk_from_ptr’"}},
                                                                       "kinds": ["call",
                                                                                 "function"],
                                                                       "nestingLevel": 5,
                                                                       "executionOrder": 29},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(30)",
                                                                                      "gcc/analyzer/checker_event/kind": "return",
                                                                                      "gcc/analyzer/checker_event/original_fndecl": {"index": 5,
                                                                                                                                     "fullyQualifiedName": "talloc_chunk_from_ptr"},
                                                                                      "gcc/analyzer/checker_event/original_depth": 5},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 519,
                                                                                                                    "startColumn": 9,
                                                                                                                    "endColumn": 63},
                                                                                                         "contextRegion": {"startLine": 519,
                                                                                                                           "snippet": {"text": "\ttalloc_abort(\"Bad talloc magic value - unknown value\");\n"}}},
                                                                                    "logicalLocations": [{"index": 6,
                                                                                                          "fullyQualifiedName": "talloc_abort_unknown_value"}],
                                                                                    "message": {"text": "returning to ‘talloc_chunk_from_ptr’ from ‘talloc_abort’"}},
                                                                       "kinds": ["return",
                                                                                 "function"],
                                                                       "nestingLevel": 6,
                                                                       "executionOrder": 30},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(31)",
                                                                                      "gcc/analyzer/checker_event/kind": "return"},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 762,
                                                                                                                    "startColumn": 26,
                                                                                                                    "endColumn": 56},
                                                                                                         "contextRegion": {"startLine": 762,
                                                                                                                           "snippet": {"text": "\t\tparent = talloc_chunk_from_ptr(context);\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "__talloc_with_prefix"}],
                                                                                    "message": {"text": "returning to ‘__talloc_with_prefix’ from ‘talloc_chunk_from_ptr’"}},
                                                                       "kinds": ["return",
                                                                                 "function"],
                                                                       "nestingLevel": 4,
                                                                       "executionOrder": 31},
                                                                      {"properties": {"gcc/analyzer/checker_event/emission_id": "(32)",
                                                                                      "gcc/analyzer/checker_event/kind": "warning"},
                                                                       "location": {"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                                                              "uriBaseId": "PWD"},
                                                                                                         "region": {"startLine": 764,
                                                                                                                    "startColumn": 21,
                                                                                                                    "endColumn": 34},
                                                                                                         "contextRegion": {"startLine": 764,
                                                                                                                           "snippet": {"text": "\t\tif (parent->limit != NULL) {\n"}}},
                                                                                    "logicalLocations": [{"index": 0,
                                                                                                          "fullyQualifiedName": "__talloc_with_prefix"}],
                                                                                    "message": {"text": "dereference of NULL ‘talloc_chunk_from_ptr(context)’"}},
                                                                       "kinds": ["danger"],
                                                                       "nestingLevel": 4,
                                                                       "executionOrder": 32}]}]}],
                        "relatedLocations": [{"physicalLocation": {"artifactLocation": {"uri": "../../talloc.c",
                                                                                        "uriBaseId": "PWD"},
                                                                   "region": {"startLine": 33},
                                                                   "contextRegion": {"startLine": 33,
                                                                                     "snippet": {"text": "#include \"replace.h\"\n"}}},
                                              "relationships": [{"target": 0,
                                                                 "kinds": ["includes"]},
                                                                {"target": 2,
                                                                 "kinds": ["includes"]}],
                                              "id": 1}]}],
           "logicalLocations": [{"name": "__talloc_with_prefix",
                                 "fullyQualifiedName": "__talloc_with_prefix",
                                 "decoratedName": "__talloc_with_prefix",
                                 "kind": "function",
                                 "index": 0},
                                {"name": "talloc_vasprintf_append_buffer.part.0",
                                 "fullyQualifiedName": "talloc_vasprintf_append_buffer.part.0",
                                 "decoratedName": "talloc_vasprintf_append_buffer.part.0",
                                 "kind": "function",
                                 "index": 1},
                                {"name": "talloc_vasprintf",
                                 "fullyQualifiedName": "talloc_vasprintf",
                                 "decoratedName": "talloc_vasprintf",
                                 "kind": "function",
                                 "index": 2},
                                {"name": "_vasprintf_tc",
                                 "fullyQualifiedName": "_vasprintf_tc",
                                 "decoratedName": "_vasprintf_tc",
                                 "kind": "function",
                                 "index": 3},
                                {"name": "__talloc",
                                 "fullyQualifiedName": "__talloc",
                                 "decoratedName": "__talloc",
                                 "kind": "function",
                                 "index": 4},
                                {"name": "talloc_chunk_from_ptr",
                                 "fullyQualifiedName": "talloc_chunk_from_ptr",
                                 "decoratedName": "talloc_chunk_from_ptr",
                                 "kind": "function",
                                 "index": 5},
                                {"name": "talloc_abort_unknown_value",
                                 "fullyQualifiedName": "talloc_abort_unknown_value",
                                 "decoratedName": "talloc_abort_unknown_value",
                                 "kind": "function",
                                 "index": 6},
                                {"name": "talloc_abort",
                                 "fullyQualifiedName": "talloc_abort",
                                 "decoratedName": "talloc_abort",
                                 "kind": "function",
                                 "index": 7}]}]}
