diff options
author | Nick Kew <niq@apache.org> | 2010-07-20 00:08:38 +0000 |
---|---|---|
committer | Nick Kew <niq@apache.org> | 2010-07-20 00:08:38 +0000 |
commit | 9142f78eafe3ce94975e692c9b8ce2fcc7cc45e0 (patch) | |
tree | 3d16302623cd768ecb02cc8bc4e4dd8d01ed4f63 /dbd | |
parent | e21d789e11321f49ea93d8a32d8ce6fdf953ad73 (diff) | |
download | apr-9142f78eafe3ce94975e692c9b8ce2fcc7cc45e0.tar.gz |
Copy memory returned by dbd_mysql_get_entry
PR 46421 tells us this is necessary, though it looks as if it shouldn't be.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@965687 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dbd')
-rw-r--r-- | dbd/apr_dbd_mysql.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/dbd/apr_dbd_mysql.c b/dbd/apr_dbd_mysql.c index 7cad22d6f..ddad6c89c 100644 --- a/dbd/apr_dbd_mysql.c +++ b/dbd/apr_dbd_mysql.c @@ -363,6 +363,7 @@ static int dbd_mysql_get_entry(const apr_dbd_row_t *row, int n, static const char *dbd_mysql_get_entry(const apr_dbd_row_t *row, int n) { MYSQL_BIND *bind; + const char *result = NULL; if (dbd_mysql_num_cols(row->res) <= n) { return NULL; } @@ -375,13 +376,20 @@ static const char *dbd_mysql_get_entry(const apr_dbd_row_t *row, int n) return NULL; } else { - return bind->buffer; + result = bind->buffer; } } else { - return row->row[n]; + result = row->row[n]; } - return NULL; + if (result != NULL) { + /* need to copy this - PR 46421 + * Don't know why, when it apparently came from an array + * in the first place. + */ + result = apr_pstrdup(row->res->pool, result); + } + return result; } #endif |