git.droids-corp.org
/
protos
/
libecoli.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use helper in cmd node
[protos/libecoli.git]
/
lib
/
main.c
diff --git
a/lib/main.c
b/lib/main.c
index
2a08cdd
..
1b2b7ef
100644
(file)
--- a/
lib/main.c
+++ b/
lib/main.c
@@
-142,6
+142,7
@@
static struct debug_alloc_hdr_list debug_alloc_hdr_list =
struct debug_alloc_hdr {
TAILQ_ENTRY(debug_alloc_hdr) next;
const char *file;
struct debug_alloc_hdr {
TAILQ_ENTRY(debug_alloc_hdr) next;
const char *file;
+ unsigned int seq;
unsigned int line;
size_t size;
void *stack[STACK_SZ];
unsigned int line;
size_t size;
void *stack[STACK_SZ];
@@
-171,6
+172,7
@@
static void *debug_malloc(size_t size, const char *file, unsigned int line)
if (hdr == NULL) {
ret = NULL;
} else {
if (hdr == NULL) {
ret = NULL;
} else {
+ hdr->seq = malloc_seq;
hdr->file = file;
hdr->line = line;
hdr->size = size;
hdr->file = file;
hdr->line = line;
hdr->size = size;
@@
-286,6
+288,7
@@
static void *debug_realloc(void *ptr, size_t size, const char *file,
}
if (hdr != NULL) {
}
if (hdr != NULL) {
+ hdr->seq = malloc_seq;
hdr->file = file;
hdr->line = line;
hdr->size = size;
hdr->file = file;
hdr->line = line;
hdr->size = size;
@@
-318,8
+321,8
@@
static int debug_alloc_dump_leaks(void)
TAILQ_FOREACH(hdr, &debug_alloc_hdr_list, next) {
EC_LOG(EC_LOG_ERR,
TAILQ_FOREACH(hdr, &debug_alloc_hdr_list, next) {
EC_LOG(EC_LOG_ERR,
- "%s:%d: error: memory leak size=%zd ptr=%p\n",
- hdr->file, hdr->line, hdr->size, hdr + 1);
+ "%s:%d: error: memory leak s
eq=%u s
ize=%zd ptr=%p\n",
+ hdr->file, hdr->line, hdr->s
eq, hdr->s
ize, hdr + 1);
buffer = backtrace_symbols(hdr->stack, hdr->stacklen);
if (buffer == NULL) {
for (i = 0; i < hdr->stacklen; i++)
buffer = backtrace_symbols(hdr->stack, hdr->stacklen);
if (buffer == NULL) {
for (i = 0; i < hdr->stacklen; i++)