apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r965687 - /apr/apr/trunk/dbd/apr_dbd_mysql.c
Date Tue, 20 Jul 2010 00:08:38 GMT
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
 



Mime
View raw message