diff --git a/modules/imgproc/test/test_imgwarp.cpp b/modules/imgproc/test/test_imgwarp.cpp
index 4ffd50b41ad32dfeca7a3ee7acbe615ae52164cc..441d06243aa0c1b611ecf5a584f6ffc23999dc2b 100644
--- a/modules/imgproc/test/test_imgwarp.cpp
+++ b/modules/imgproc/test/test_imgwarp.cpp
@@ -1383,6 +1383,9 @@ TEST(Imgproc_cvWarpAffine, regression)
     int h = src->height;
     cv2DRotationMatrix(cvPoint2D32f(w*0.5f, h*0.5f), 45.0, 1.0, &M);
     cvWarpAffine(src, dst, &M);
+
+    cvReleaseImage(&src);
+    cvReleaseImage(&dst);
 }
 
 TEST(Imgproc_fitLine_vector_3d, regression)