From 635fde2d16d30f8f22c551b8c550fdb78b7fd8b4 Mon Sep 17 00:00:00 2001 From: "Stephen R. van den Berg" <srb@cuci.nl> Date: Wed, 14 Apr 2021 12:09:18 +0200 Subject: [PATCH] pgsql: Clip _sprintf() in destructed objects. --- lib/modules/Sql.pmod/pgsql.pike | 2 ++ lib/modules/Sql.pmod/pgsql_util.pmod | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/lib/modules/Sql.pmod/pgsql.pike b/lib/modules/Sql.pmod/pgsql.pike index b1b62567dc..4eba9ef724 100644 --- a/lib/modules/Sql.pmod/pgsql.pike +++ b/lib/modules/Sql.pmod/pgsql.pike @@ -86,6 +86,8 @@ private Thread.Mutex resyncmux; protected string _sprintf(int type) { string res; + if (!this) // Not in destructed objects + return ""; switch(type) { case 'O': res = sprintf(DRIVERNAME"(%s@%s:%d/%s,%d,%d)", diff --git a/lib/modules/Sql.pmod/pgsql_util.pmod b/lib/modules/Sql.pmod/pgsql_util.pmod index 99fd4622fe..4c767f7a22 100644 --- a/lib/modules/Sql.pmod/pgsql_util.pmod +++ b/lib/modules/Sql.pmod/pgsql_util.pmod @@ -717,6 +717,8 @@ outer: private string _sprintf(int type) { string res; + if (!this) // Not in destructed objects + return ""; switch (type) { case 'O': int fd = -1; @@ -822,6 +824,8 @@ class sql_result { protected string _sprintf(int type) { string res; + if (!this) // Not in destructed objects + return ""; switch (type) { case 'O': int fd = -1; @@ -1822,6 +1826,8 @@ class proxy { private string _sprintf(int type) { string res; + if (!this) // Not in destructed objects + return ""; switch (type) { case 'O': res = sprintf(DRIVERNAME".proxy(%s@%s:%d/%s,%d,%d)", -- GitLab