summaryrefslogtreecommitdiff
path: root/ext/sqlite/sqlite.c
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2003-04-19 10:28:45 +0000
committerWez Furlong <wez@php.net>2003-04-19 10:28:45 +0000
commit664026025398ecdbb218334aee86259165eeec38 (patch)
tree35f2bdd7484a4c1c0b87ea477fa8e80171e47b05 /ext/sqlite/sqlite.c
parenta17d2f37ea2a4e2a2703ca729a089d167e64df64 (diff)
downloadphp-git-664026025398ecdbb218334aee86259165eeec38.tar.gz
Fix 2 potential segfaults.
Diffstat (limited to 'ext/sqlite/sqlite.c')
-rw-r--r--ext/sqlite/sqlite.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/sqlite/sqlite.c b/ext/sqlite/sqlite.c
index 630e701374..da712c1cb1 100644
--- a/ext/sqlite/sqlite.c
+++ b/ext/sqlite/sqlite.c
@@ -144,7 +144,9 @@ static void real_result_dtor(struct php_sqlite_result *res)
for (i = 0; i < res->nrows; i++) {
base = i * res->ncolumns;
for (j = 0; j < res->ncolumns; j++) {
- efree(res->table[base + j]);
+ if (res->table[base + j] != NULL) {
+ efree(res->table[base + j]);
+ }
}
}
if (res->table) {
@@ -465,7 +467,6 @@ PHP_FUNCTION(sqlite_popen)
}
/* }}} */
-
/* {{{ proto resource sqlite_open(string filename [, int mode, string &errmessage])
Opens an SQLite database. Will create the database if it does not exist */
PHP_FUNCTION(sqlite_open)
@@ -891,7 +892,7 @@ PHP_FUNCTION(sqlite_field_name)
RETURN_FALSE;
}
- RETURN_STRING(res->table[field], 1);
+ RETURN_STRING(res->col_names[field], 1);
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field name not available for unbuffered queries");
RETURN_FALSE;