From 9743ac15d9591ebe42da6cd6be2c751387361677 Mon Sep 17 00:00:00 2001 From: hellerve Date: Sun, 26 Jan 2020 22:14:25 +0100 Subject: [PATCH] memory bugfix, vbump --- README.md | 2 +- examples/simple.carp | 2 ++ sqlite3.carp | 2 +- sqlite3_helper.h | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index acedf45..5863acf 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ everything, but it tries to be useful. ## Installation ```clojure -(load "https://veitheller.de/git/carpentry/sqlite3@0.0.1") +(load "https://veitheller.de/git/carpentry/sqlite3@0.0.2") ``` ## Usage diff --git a/examples/simple.carp b/examples/simple.carp index 209e840..7c148c0 100644 --- a/examples/simple.carp +++ b/examples/simple.carp @@ -1,6 +1,8 @@ (load "sqlite3.carp") (use SQLite3) +(add-cflag "-fsanitize=address") + (defn main [] (let-do [db (Result.unsafe-from-success (SQLite3.open "test.db"))] ; we can create a table diff --git a/sqlite3.carp b/sqlite3.carp index 1734b6b..065a9a1 100644 --- a/sqlite3.carp +++ b/sqlite3.carp @@ -7,7 +7,7 @@ to wrap everything, but it tries to be useful. ## Installation ```clojure -(load \"https://veitheller.de/git/carpentry/sqlite3@0.0.1\") +(load \"https://veitheller.de/git/carpentry/sqlite3@0.0.2\") ``` ## Usage diff --git a/sqlite3_helper.h b/sqlite3_helper.h index 936e9c4..f27a039 100644 --- a/sqlite3_helper.h +++ b/sqlite3_helper.h @@ -176,14 +176,14 @@ const char* SQLite3_exec_internal(sqlite3_stmt* s, SQLiteRows* rows) { break; case SQLITE_TEXT: { len = sqlite3_column_bytes(s, i); - c->s = CARP_MALLOC(len); + c->s = CARP_MALLOC(len+1); memcpy(c->s, sqlite3_column_text(s, i), len); c->s[len] = '\0'; break; } case SQLITE_BLOB: { len = sqlite3_column_bytes(s, i); - c->s = CARP_MALLOC(len); + c->s = CARP_MALLOC(len+1); memcpy(c->s, sqlite3_column_blob(s, i), len); c->s[len] = '\0'; break;