提交 e14e4f84 编写于 作者: M Megvii Engine Team 提交者: liuqingyi

fix(server): fix a bug in get_host_ip

GitOrigin-RevId: 59c09d96df6c180e62ddce85f8f2a04fc7fa20ae
上级 6f3c7145
......@@ -42,7 +42,7 @@ char* get_host_ip() {
struct sockaddr_in* sin = (struct sockaddr_in*)p->ifa_addr;
const char* host_ip = inet_ntoa(sin->sin_addr);
MEGRAY_INFO("using net device %s (%s)", name, host_ip);
char* ret = new char(strlen(host_ip) + 1);
char* ret = new char[strlen(host_ip) + 1];
strcpy(ret, host_ip);
freeifaddrs(ifa);
return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册