mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
- Fix testbound for alloc stats strdup in util/alloc.c.
This commit is contained in:
parent
befa7d8cd8
commit
6106528a50
2 changed files with 1 additions and 19 deletions
|
|
@ -72,23 +72,6 @@ int daemon_main(int argc, char* argv[]);
|
||||||
/** config files (removed at exit) */
|
/** config files (removed at exit) */
|
||||||
static struct config_strlist* cfgfiles = NULL;
|
static struct config_strlist* cfgfiles = NULL;
|
||||||
|
|
||||||
#ifdef UNBOUND_ALLOC_STATS
|
|
||||||
# define strdup(s) unbound_stat_strdup_log(s, __FILE__, __LINE__, __func__)
|
|
||||||
char* unbound_stat_strdup_log(char* s, const char* file, int line,
|
|
||||||
const char* func);
|
|
||||||
char* unbound_stat_strdup_log(char* s, const char* file, int line,
|
|
||||||
const char* func) {
|
|
||||||
char* result;
|
|
||||||
size_t len;
|
|
||||||
if(!s) return NULL;
|
|
||||||
len = strlen(s);
|
|
||||||
log_info("%s:%d %s strdup(%u)", file, line, func, (unsigned)len+1);
|
|
||||||
result = unbound_stat_malloc(len+1);
|
|
||||||
memmove(result, s, len+1);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
#endif /* UNBOUND_ALLOC_STATS */
|
|
||||||
|
|
||||||
/** give commandline usage for testbound. */
|
/** give commandline usage for testbound. */
|
||||||
static void
|
static void
|
||||||
testbound_usage(void)
|
testbound_usage(void)
|
||||||
|
|
|
||||||
|
|
@ -475,8 +475,7 @@ char *unbound_stat_strdup(const char* s)
|
||||||
len = strlen(s);
|
len = strlen(s);
|
||||||
res = unbound_stat_malloc(len+1);
|
res = unbound_stat_malloc(len+1);
|
||||||
if(!res) return NULL;
|
if(!res) return NULL;
|
||||||
memmove(res, s, len);
|
memmove(res, s, len+1);
|
||||||
res[len]=0;
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue