The ByteBuffer returned by stbi_load_from_memory simply wraps the pointer returned by the native function. ByteBuffer.allocateDirect is not called, any allocation happens internally in stb_image. You can (and should) free the image explicitly using stbi_image_free.
Advanced info: stb_image and a few other bindings can be configured with custom memory allocations functions, at build time usually. LWJGL takes advantage of that and configures everything to use the same allocator as the one used by MemoryUtil (which is configurable at runtime). This means that, effectively, stbi_image_free is equivalent to MemoryUtil.memFree.