Changeset:
a9ff93ffd0dd
https://sourceforge.net/p/mrbs/hg-code/ci/a9ff93ffd0dd18cad4a157b2a98a358366f712b8
Author:
Campbell Morrison <[email protected]>
Date:
Sat Dec 19 15:42:54 2015 +0000
Log message:
Added some sql_free() calls for good measure and at the same time modified
sql_free() to do nothing if the argument is not a resource (probably because it
has already been freed)
diffstat:
web/dbsys.inc | 9 ++++++++-
web/mrbs_sql.inc | 8 ++++++--
2 files changed, 14 insertions(+), 3 deletions(-)
diffs (44 lines):
diff -r 413150c1a64b -r a9ff93ffd0dd web/dbsys.inc
--- a/web/dbsys.inc Sat Dec 19 15:23:51 2015 +0000
+++ b/web/dbsys.inc Sat Dec 19 15:42:54 2015 +0000
@@ -41,7 +41,14 @@
function sql_free($r)
{
global $dbsys;
-
+
+ if (!is_resource($r))
+ {
+ // No need to do anything - resource has probably been
+ // freed automatically by reading to its end
+ return;
+ }
+
if (func_num_args() > 1)
{
$handle = func_get_arg(1);
diff -r 413150c1a64b -r a9ff93ffd0dd web/mrbs_sql.inc
--- a/web/mrbs_sql.inc Sat Dec 19 15:23:51 2015 +0000
+++ b/web/mrbs_sql.inc Sat Dec 19 15:42:54 2015 +0000
@@ -472,7 +472,9 @@
fatal_error(FALSE, get_vocab("fatal_db_error"));
}
- return sql_all_rows_keyed($res);
+ $result = sql_all_rows_keyed($res);
+ sql_free($res);
+ return $result;
}
@@ -497,7 +499,9 @@
fatal_error(TRUE, get_vocab("fatal_db_error"));
}
- return sql_all_rows_keyed($res);
+ $result = sql_all_rows_keyed($res);
+ sql_free($res);
+ return $result;
}
------------------------------------------------------------------------------
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits