提交 1c908df6 编写于 作者: H Helin Wang

fix test memory leak

上级 d08c8ea7
...@@ -8,6 +8,20 @@ void panic() { ...@@ -8,6 +8,20 @@ void panic() {
*(void*)0; *(void*)0;
} }
void releaseParam(paddle_parameter* param) {
if (param != NULL) {
if (param->name != NULL) {
free(param->name);
}
if (param->content != NULL) {
free(param->content);
}
free(param);
}
}
int main() { int main() {
char addr[] = "localhost:3000"; char addr[] = "localhost:3000";
client c = paddle_new_pserver_client(addr); client c = paddle_new_pserver_client(addr);
...@@ -51,6 +65,9 @@ int main() { ...@@ -51,6 +65,9 @@ int main() {
panic(); panic();
} }
releaseParam(params[0]);
releaseParam(params[1]);
if (!paddle_save_model(c, "/tmp/")) { if (!paddle_save_model(c, "/tmp/")) {
panic(); panic();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册