Memory leaks in multiVis.c
This issue is intended for addressing several memory leaks which were found in multiVis.c:
- The functions ReadRegionsInList() and ReadAreaToImage() do not destroy the temporary images used to construct full image capture.
- The function TransferImage() does not release the memory occupied by XColor array which is allocated by QueryColorMap()
Proposed patch:
@@ -398,6 +398,7 @@ } break; } + free(colors); } static XImage * @@ -456,6 +457,7 @@ srcRect_width,srcRect_height,AllPlanes,format) ; TransferImage(disp,reg_image,srcRect_width, srcRect_height,reg,ximage,dst_x,dst_y) ; + XDestroyImage(reg_image); } } return ximage ; @@ -637,6 +639,9 @@ XDestroyImage (image); } /* end of src_in_overlay */ } /** end transparency **/ + if (ximage_ipm != NULL) { + XDestroyImage(ximage_ipm); + } destroy_region_list( vis_regions); if (vis_image_regions) destroy_region_list( vis_image_regions ); FreeXVisualInfo(pVisuals, pOverlayVisuals, pImageVisuals);