Skip to content

Commit ebe6457

Browse files
committed
Free the array after it has been set to the prepared statement
1 parent 8e8e556 commit ebe6457

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/main/java/org/apache/ibatis/type/ArrayTypeHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public void setNonNullParameter(PreparedStatement ps, int i, Object parameter, J
5050
array = ps.getConnection().createArrayOf(jdbcType.name(), values);
5151
}
5252
ps.setArray(i, array);
53+
array.free();
5354
}
5455

5556
@Override

src/test/java/org/apache/ibatis/type/ArrayTypeHandlerTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class ArrayTypeHandlerTest extends BaseTypeHandlerTest {
3939
public void shouldSetParameter() throws Exception {
4040
TYPE_HANDLER.setParameter(ps, 1, mockArray, null);
4141
verify(ps).setArray(1, mockArray);
42+
verify(mockArray).free();
4243
}
4344

4445
@Test

0 commit comments

Comments
 (0)