summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Golubev <fatzer2@gmail.com>2024-03-16 19:05:22 +0300
committerTDE Gitea <gitea@mirror.git.trinitydesktop.org>2024-03-17 03:10:58 +0000
commitbcda4011918a88064d35908b089a3300e187245a (patch)
treef456cc55210edfdcfbf5d3ab52f157f4ac71a685
parent1278ed0dad0a51d280d7b8b934a9280b459b107c (diff)
downloadtqt3-bcda4011918a88064d35908b089a3300e187245a.tar.gz
tqt3-bcda4011918a88064d35908b089a3300e187245a.zip
Fix TQString::sprintf() not calling va_end() in case of bad cformat
Also rearrange code a bit so it would be obvious that the function doesn't return a dangling reference. Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
-rw-r--r--src/tools/qstring.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/tools/qstring.cpp b/src/tools/qstring.cpp
index 26e9b61cd..28b9c520c 100644
--- a/src/tools/qstring.cpp
+++ b/src/tools/qstring.cpp
@@ -2619,13 +2619,12 @@ TQString &TQString::sprintf(const char *cformat, ...)
if ( !cformat || !*cformat ) {
// TQt 1.x compat
*this = fromLatin1( "" );
- return *this;
+ } else {
+ vsprintf(cformat, ap);
}
- TQString &s = vsprintf(cformat, ap);
-
va_end(ap);
- return s;
+ return *this;
}
TQString &TQString::vsprintf( const char* cformat, va_list ap )