aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-11-02 10:18:25 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-11-02 10:18:25 +0200
commit15f718bbf874a77b1079a55f29335447aeba17dd (patch)
tree45912ac897ccc816ecccfbe214899eb2e2b2da54
parent0f4004313121397fbd5375d663b24ed0dee23616 (diff)
Prevent potential image overwrite in MySQL query result
-rw-r--r--common/query/driver.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/common/query/driver.cxx b/common/query/driver.cxx
index d9d0f12..45392b8 100644
--- a/common/query/driver.cxx
+++ b/common/query/driver.cxx
@@ -422,7 +422,12 @@ main (int argc, char* argv[])
++i;
assert (i != r.end ());
auto_ptr<person> joe (db->load<person> (3));
- assert (i->last_name_ == "Doe");
+ assert (i->last_name_ == "Doe"); // Actual load.
+
+ person p;
+ joe.reset (db->load<person> (3)); // Overwrite object image again.
+ i.load (p);
+ assert (p.last_name_ == "Doe");
t.commit ();
}