Commit ef331826 authored by Johannes Schindelin's avatar Johannes Schindelin

Fix two issues in rfbGetClient()

There was an unnecessary assignment, and an assignment of a string that
was to be free()ed later, so it has to be strdup()ed.

Both issues spotted by Roman Held.
Signed-off-by: 's avatarJohannes Schindelin <johannes.schindelin@gmx.de>
parent d11b2abd
......@@ -111,10 +111,9 @@ rfbClient* rfbGetClient(int bitsPerSample,int samplesPerPixel,
return NULL;
}
initAppData(&client->appData);
client->programName = NULL;
client->endianTest = 1;
client->programName="";
client->serverHost="";
client->serverHost=strdup("");
client->serverPort=5900;
client->CurrentKeyboardLedState = 0;
......@@ -265,6 +264,9 @@ rfbBool rfbInitClient(rfbClient* client,int* argc,char** argv) {
} else {
char* colon=strchr(argv[i],':');
if(client->serverHost)
free(client->serverHost);
if(colon) {
client->serverHost=strdup(argv[i]);
client->serverHost[(int)(colon-argv[i])]='\0';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment