示例#1
0
int common_init() {
	_printf = find_printf();
	if(_printf == NULL) {
		fb_print("Unable to find printf\n");
		return -1;
	} else {
		printf("Found printf at 0x%x\n", _printf);
	}

	_malloc = find_malloc();
	if(_malloc == NULL) {
		puts("Unable to find malloc\n");
		return -1;
	} else {
		printf("Found malloc at 0x%x\n", _malloc);
	}

	_free = find_free();
	if(_free == NULL) {
		puts("Unable to find free\n");
		return -1;
	} else {
		printf("Found free at 0x%x\n", _free);
	}

	return 0;
}
int rm_malloc(struct mlist_t *file_list, void *addr)
{
	struct mlist_t *el = find_malloc(file_list, addr);

	if (el != NULL) {
		list_rm_el(&(file_list->addr), el);
		return 1;
	} else {
		return 0;
	}
}