Unverified Commit 3ff56a6d authored by Ozan Tezcan's avatar Ozan Tezcan Committed by GitHub
Browse files

Fix crash due to free() call for a string literal in redis-benchmark (#9546)

parent 9967a53f
...@@ -1421,6 +1421,7 @@ int parseOptions(int argc, char **argv) { ...@@ -1421,6 +1421,7 @@ int parseOptions(int argc, char **argv) {
config.keepalive = atoi(argv[++i]); config.keepalive = atoi(argv[++i]);
} else if (!strcmp(argv[i],"-h")) { } else if (!strcmp(argv[i],"-h")) {
if (lastarg) goto invalid; if (lastarg) goto invalid;
sdsfree(config.conn_info.hostip);
config.conn_info.hostip = sdsnew(argv[++i]); config.conn_info.hostip = sdsnew(argv[++i]);
} else if (!strcmp(argv[i],"-p")) { } else if (!strcmp(argv[i],"-p")) {
if (lastarg) goto invalid; if (lastarg) goto invalid;
...@@ -1720,7 +1721,7 @@ int main(int argc, char **argv) { ...@@ -1720,7 +1721,7 @@ int main(int argc, char **argv) {
config.loop = 0; config.loop = 0;
config.idlemode = 0; config.idlemode = 0;
config.clients = listCreate(); config.clients = listCreate();
config.conn_info.hostip = "127.0.0.1"; config.conn_info.hostip = sdsnew("127.0.0.1");
config.conn_info.hostport = 6379; config.conn_info.hostport = 6379;
config.hostsocket = NULL; config.hostsocket = NULL;
config.tests = NULL; config.tests = NULL;
......
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