Hi all. lâu lắm mới có câu hỏi [IMG]images/smilies/smile.png[/IMG]
mình đang có troubles với opensource: memtraq cho embedded
không hiểu vì lý do gì mà nó chỉ call free còn malloc thì không
còn với code test của mình thì nó không call function nào cả (code test trên ubuntu 14.04, gcc 4.8.2)

malloc.c
Mã:
#include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h>

void *malloc(size_t s)
{
	printf("custom malloc: %d
", s);
	return NULL;
}

void free(void *p)
{
	printf("custom free
");
}

testmalloc.c
Mã:
#include <stdlib.h>
#include <stdio.h>

int main()
{
	printf("START
");
	char **x = malloc(10);
	free(x);
	return 0;
}
output: START

với 1 đoạn code khác chi tiết hơn thì mình thêm dlsym vào thì nó có gọi nhưng không phải lúc nào cũng thế
không rõ nguyên nhân chính ở đây là gì

malloc.c build ra libmalloc.so
testmalloc.c build ra testmalloc
run: LD_PRELOAD=/absolute/path/to/libmalloc.so ./testmalloc