Yes, and in fact this is unsafe. When a `realloc` fails, this leaks the original buffer. Do

    cdef T* p = realloc(some_ptr, n)
    if p == NULL:
        return -1  # let __dealloc__ do the free
    some_ptr = p

Also, the separate `malloc` is not needed. The way I solved this in my recent changes is:

* all pointers are `NULL` initially
* all allocation is done using `realloc`, because `realloc(NULL, n)` is equivalent to `malloc(n)`.