coap_malloc_type() and coap_free_type() provide an abstract API for dynamic memory management on different platforms. resource.c still is in transition and needs more cleanup.