The vulnerability, as described, is a memory leak in the TXT image coder (coders/txt.c) of ImageMagick. The provided commit e6394098af39a9689bb5f0b4eb6a9968e449a8d3 directly addresses this issue. The patch modifies the ReadTEXTImage function. Specifically, it adds a call to DestroyImageList(texture) within an error handling block. This block is executed if GetTypeMetrics fails. Before the patch, if GetTypeMetrics failed, the function would throw an exception and return, but it would not release the memory allocated for the texture image that was read earlier in the function. This failure to release memory is the root cause of the memory leak. Therefore, the ReadTEXTImage function is the vulnerable function, as it is responsible for both allocating and, in the failure case, failing to deallocate the memory for the texture image.