diff options
Diffstat (limited to 'unix/xserver/hw')
-rw-r--r-- | unix/xserver/hw/vnc/RFBGlue.cc | 20 | ||||
-rw-r--r-- | unix/xserver/hw/vnc/vncExtInit.cc | 5 |
2 files changed, 7 insertions, 18 deletions
diff --git a/unix/xserver/hw/vnc/RFBGlue.cc b/unix/xserver/hw/vnc/RFBGlue.cc index 10393e68..4f63397e 100644 --- a/unix/xserver/hw/vnc/RFBGlue.cc +++ b/unix/xserver/hw/vnc/RFBGlue.cc @@ -113,9 +113,7 @@ int vncSetParamSimple(const char *nameAndValue) char* vncGetParam(const char *name) { - rfb::VoidParameter *param; - char *value; - char *ret; + VoidParameter *param; // Hack to avoid exposing password! if (strcasecmp(name, "Password") == 0) @@ -125,15 +123,7 @@ char* vncGetParam(const char *name) if (param == NULL) return NULL; - value = param->getValueStr(); - if (value == NULL) - return NULL; - - ret = strdup(value); - - delete [] value; - - return ret; + return strdup(param->getValueStr().c_str()); } const char* vncGetParamDesc(const char *name) @@ -234,7 +224,7 @@ int vncIsTCPPortUsed(int port) char* vncConvertLF(const char* src, size_t bytes) { try { - return convertLF(src, bytes); + return strDup(convertLF(src, bytes).c_str()); } catch (...) { return NULL; } @@ -243,7 +233,7 @@ char* vncConvertLF(const char* src, size_t bytes) char* vncLatin1ToUTF8(const char* src, size_t bytes) { try { - return latin1ToUTF8(src, bytes); + return strDup(latin1ToUTF8(src, bytes).c_str()); } catch (...) { return NULL; } @@ -252,7 +242,7 @@ char* vncLatin1ToUTF8(const char* src, size_t bytes) char* vncUTF8ToLatin1(const char* src, size_t bytes) { try { - return utf8ToLatin1(src, bytes); + return strDup(utf8ToLatin1(src, bytes).c_str()); } catch (...) { return NULL; } diff --git a/unix/xserver/hw/vnc/vncExtInit.cc b/unix/xserver/hw/vnc/vncExtInit.cc index 4c1fdd4d..0292a6d1 100644 --- a/unix/xserver/hw/vnc/vncExtInit.cc +++ b/unix/xserver/hw/vnc/vncExtInit.cc @@ -348,14 +348,13 @@ int vncConnectClient(const char *addr) return 0; } - char *host; + std::string host; int port; getHostAndPort(addr, &host, &port, 5500); try { - network::Socket* sock = new network::TcpSocket(host, port); - delete [] host; + network::Socket* sock = new network::TcpSocket(host.c_str(), port); desktop[0]->addClient(sock, true); } catch (rdr::Exception& e) { vlog.error("Reverse connection: %s",e.str()); |