8000 Merge pull request #181 from lightyang/master · mauricio/postgresql-async@5be0eb1 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Dec 3, 2019. It is now read-only.

Commit 5be0eb1

Browse files
committed
Merge pull request #181 from lightyang/master
Fixed ByteBuf leaks
2 parents 773a28d + 8fb137a commit 5be0eb1

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

postgresql-async/src/main/scala/com/github/mauricio/async/db/postgresql/PostgreSQLConnection.scala

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,16 @@ class PostgreSQLConnection
191191
var x = 0
192192

193193
while ( x < m.values.size ) {
194-
items(x) = if ( m.values(x) == null ) {
194+
val buf = m.values(x)
195+
items(x) = if ( buf == null ) {
195196
null
196197
} else {
197-
val columnType = this.currentQuery.get.columnTypes(x)
198-
this.decoderRegistry.decode(columnType, m.values(x), configuration.charset)
198+
try {
199+
val columnType = this.currentQuery.get.columnTypes(x)
200+
this.decoderRegistry.decode(columnType, buf, configuration.charset)
201+
} finally {
202+
buf.release()
203+
}
199204
}
200205
x += 1
201206
}

0 commit comments

Comments
 (0)
0