summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-10-10 01:05:03 +0200
committerAraq <rumpf_a@web.de>2012-10-10 01:05:03 +0200
commit8717742f002b8b1505daad4ce92776fabe15e671 (patch)
treeebc576bf6f124a54fb0dc0296f0b951b1c870a0c
parentfe7dd31b61b95f1e6d4d8514a251d93644ef6e7a (diff)
downloadNim-8717742f002b8b1505daad4ce92776fabe15e671.tar.gz
bugfix: leak in db_sqlite.GetValue
-rwxr-xr-xlib/impure/db_sqlite.nim8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/impure/db_sqlite.nim b/lib/impure/db_sqlite.nim
index 5196e4807..d3ff3c0d2 100755
--- a/lib/impure/db_sqlite.nim
+++ b/lib/impure/db_sqlite.nim
@@ -130,9 +130,11 @@ proc GetValue*(db: TDbConn, query: TSqlQuery,
   var stmt = setupQuery(db, query, args)
   if step(stmt) == SQLITE_ROW:
     let cb = column_bytes(stmt, 0)
-    if cb == 0: return ""
-    result = newStringOfCap(cb)
-    add(result, column_text(stmt, 0))
+    if cb == 0: 
+      result = ""
+    else:
+      result = newStringOfCap(cb)
+      add(result, column_text(stmt, 0))
     if finalize(stmt) != SQLITE_OK: dbError(db)
   else:
     result = ""