mirror of
https://github.com/samba-team/samba.git
synced 2025-01-07 17:18:11 +03:00
talloc: fix TALLOC_VERSION_* mismatch detection
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Feb 22 00:14:34 CET 2017 on sn-devel-144
(cherry picked from commit 16ea6e1308
)
This commit is contained in:
parent
d5f579ee75
commit
b35991587d
@ -37,17 +37,13 @@
|
||||
#include <sys/auxv.h>
|
||||
#endif
|
||||
|
||||
#ifdef TALLOC_BUILD_VERSION_MAJOR
|
||||
#if (TALLOC_VERSION_MAJOR != TALLOC_BUILD_VERSION_MAJOR)
|
||||
#error "TALLOC_VERSION_MAJOR != TALLOC_BUILD_VERSION_MAJOR"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef TALLOC_BUILD_VERSION_MINOR
|
||||
#if (TALLOC_VERSION_MINOR != TALLOC_BUILD_VERSION_MINOR)
|
||||
#error "TALLOC_VERSION_MINOR != TALLOC_BUILD_VERSION_MINOR"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Special macros that are no-ops except when run under Valgrind on
|
||||
* x86. They've moved a little bit from valgrind 1.0.4 to 1.9.4 */
|
||||
@ -82,8 +78,9 @@
|
||||
static unsigned int talloc_magic = (
|
||||
~TALLOC_FLAG_MASK & (
|
||||
TALLOC_MAGIC_BASE +
|
||||
(TALLOC_VERSION_MAJOR << 12) +
|
||||
(TALLOC_VERSION_MINOR << 4)));
|
||||
(TALLOC_BUILD_VERSION_MAJOR << 24) +
|
||||
(TALLOC_BUILD_VERSION_MINOR << 16) +
|
||||
(TALLOC_BUILD_VERSION_RELEASE << 8)));
|
||||
|
||||
/* by default we abort when given a bad pointer (such as when talloc_free() is called
|
||||
on a pointer that came from malloc() */
|
||||
@ -453,7 +450,7 @@ static inline struct talloc_chunk *talloc_chunk_from_ptr(const void *ptr)
|
||||
const char *pp = (const char *)ptr;
|
||||
struct talloc_chunk *tc = discard_const_p(struct talloc_chunk, pp - TC_HDR_SIZE);
|
||||
if (unlikely((tc->flags & (TALLOC_FLAG_FREE | ~TALLOC_FLAG_MASK)) != talloc_magic)) {
|
||||
if ((tc->flags & (~0xF)) == talloc_magic) {
|
||||
if ((tc->flags & (~TALLOC_FLAG_MASK)) == talloc_magic) {
|
||||
talloc_abort_magic(tc->flags & (~TALLOC_FLAG_MASK));
|
||||
return NULL;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ extern "C" {
|
||||
*/
|
||||
|
||||
#define TALLOC_VERSION_MAJOR 2
|
||||
#define TALLOC_VERSION_MINOR 0
|
||||
#define TALLOC_VERSION_MINOR 1
|
||||
|
||||
int talloc_version_major(void);
|
||||
int talloc_version_minor(void);
|
||||
|
@ -42,6 +42,10 @@ def configure(conf):
|
||||
|
||||
conf.env.standalone_talloc = conf.IN_LAUNCH_DIR()
|
||||
|
||||
conf.define('TALLOC_BUILD_VERSION_MAJOR', int(VERSION.split('.')[0]))
|
||||
conf.define('TALLOC_BUILD_VERSION_MINOR', int(VERSION.split('.')[1]))
|
||||
conf.define('TALLOC_BUILD_VERSION_RELEASE', int(VERSION.split('.')[2]))
|
||||
|
||||
conf.env.disable_python = getattr(Options.options, 'disable_python', False)
|
||||
|
||||
if not conf.env.standalone_talloc:
|
||||
|
Loading…
Reference in New Issue
Block a user