You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by ni...@apache.org on 2010/07/20 02:08:38 UTC
svn commit: r965687 - /apr/apr/trunk/dbd/apr_dbd_mysql.c
Author: niq
Date: Tue Jul 20 00:08:38 2010
New Revision: 965687
URL: http://svn.apache.org/viewvc?rev=965687&view=rev
Log:
Copy memory returned by dbd_mysql_get_entry
PR 46421 tells us this is necessary, though it looks as if it shouldn't be.
Modified:
apr/apr/trunk/dbd/apr_dbd_mysql.c
Modified: apr/apr/trunk/dbd/apr_dbd_mysql.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/dbd/apr_dbd_mysql.c?rev=965687&r1=965686&r2=965687&view=diff
==============================================================================
--- apr/apr/trunk/dbd/apr_dbd_mysql.c (original)
+++ apr/apr/trunk/dbd/apr_dbd_mysql.c Tue Jul 20 00:08:38 2010
@@ -363,6 +363,7 @@ static int dbd_mysql_get_entry(const apr
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(c
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