[vala] sqlite3: Fix wrappers to not assign to invalid output parameter.
- From: Evan Nemerson <evann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] sqlite3: Fix wrappers to not assign to invalid output parameter.
- Date: Fri, 14 May 2010 05:02:12 +0000 (UTC)
commit 176f57c85e553de21983470353ccdb4aaf41fc4f
Author: Julian Andres Klode <jak jak-linux org>
Date: Thu May 13 20:39:52 2010 -0700
sqlite3: Fix wrappers to not assign to invalid output parameter.
Check that the output parameter is not null before assigning to
it. Without this, passing null as errmsg results in segfaults since
the function dereferences a null pointer.
Fixes bug 61845.
vapi/sqlite3.vapi | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/vapi/sqlite3.vapi b/vapi/sqlite3.vapi
index d44db08..edff373 100644
--- a/vapi/sqlite3.vapi
+++ b/vapi/sqlite3.vapi
@@ -34,10 +34,10 @@ namespace Sqlite {
public int exec (string sql, Callback? sqlite3_callback = null, out string errmsg = null) {
unowned string sqlite_errmsg;
var ec = this._exec (sql, sqlite3_callback, out sqlite_errmsg);
- if (sqlite_errmsg != null) {
+ if (&errmsg != null) {
errmsg = sqlite_errmsg;
- Sqlite.Memory.free ((void*) sqlite_errmsg);
}
+ Sqlite.Memory.free ((void*) sqlite_errmsg);
return ec;
}
public int extended_result_codes (int onoff);
@@ -63,10 +63,10 @@ namespace Sqlite {
}
Sqlite.Database.free_table (sqlite_resultp);
- if (sqlite_errmsg != null) {
+ if (&errmsg != null) {
errmsg = sqlite_errmsg;
- Sqlite.Memory.free ((void*) sqlite_errmsg);
}
+ Sqlite.Memory.free ((void*) sqlite_errmsg);
return ec;
}
public static int open (string filename, out Database db);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]