diff options
-rw-r--r-- | libpqpp/command.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/libpqpp/command.cpp b/libpqpp/command.cpp index fa2dc1d..b901310 100644 --- a/libpqpp/command.cpp +++ b/libpqpp/command.cpp @@ -4,9 +4,8 @@ #include <string.h> static std::string addrStr(void * p, unsigned int no) { - std::string r; - r.resize(50); - r.resize(snprintf(const_cast<char *>(r.c_str()), 30, "pStatement_%u_%p", no, p)); + std::string r(50, ' '); + r.resize(snprintf(const_cast<char *>(r.c_str()), r.length(), "pStatement_%u_%p", no, p)); return r; } |