diff options
author | dscho <dscho> | 2004-10-15 21:25:57 +0000 |
---|---|---|
committer | dscho <dscho> | 2004-10-15 21:25:57 +0000 |
commit | 31d0617d3dbd8cbdb80b5eb33170121b81241cfd (patch) | |
tree | 9143a3325cd3673e9da076bc5e05ac8ee4b64874 | |
parent | 1ca3bdc71b6a4bf97dddb1ce6ec39b8275b9581e (diff) | |
download | libtdevnc-31d0617d3dbd8cbdb80b5eb33170121b81241cfd.tar.gz libtdevnc-31d0617d3dbd8cbdb80b5eb33170121b81241cfd.zip |
no need to modify argv
-rw-r--r-- | libvncclient/vncviewer.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libvncclient/vncviewer.c b/libvncclient/vncviewer.c index 4a327ed..417bd2f 100644 --- a/libvncclient/vncviewer.c +++ b/libvncclient/vncviewer.c @@ -187,10 +187,11 @@ rfbBool rfbInitClient(rfbClient* client,int* argc,char** argv) { } else { char* colon=strchr(argv[i],':'); - client->serverHost=argv[i]; if(colon) { - *colon=0; + client->serverHost=strndup(argv[i],colon-argv[i]); client->serverPort=atoi(colon+1); + } else { + client->serverHost=strdup(argv[i]); } if(client->serverPort>=0 && client->serverPort<5900) client->serverPort+=5900; @@ -212,5 +213,6 @@ rfbBool rfbInitClient(rfbClient* client,int* argc,char** argv) { } void rfbClientCleanup(rfbClient* client) { + free(client->serverHost); free(client); } |