1
0
mirror of https://github.com/haiwen/libsearpc.git synced 2025-10-18 18:58:37 +00:00

More memory leak fixed.

This commit is contained in:
Shuai Lin
2016-06-28 14:09:22 +08:00
parent 55001da28a
commit 906082601d
2 changed files with 7 additions and 0 deletions

View File

@@ -349,14 +349,18 @@ char *searpc_named_pipe_send(void *arg, const gchar *fcall_str,
uint32_t len = json_len;
if (pipe_write_n(client->pipe_fd, &len, sizeof(uint32_t)) < 0) {
g_warning("failed to send rpc call: %s", strerror(errno));
free (json_str);
return NULL;
}
if (pipe_write_n(client->pipe_fd, json_str, json_len) < 0) {
g_warning("failed to send rpc call: %s", strerror(errno));
free (json_str);
return NULL;
}
free (json_str);
if (pipe_read_n(client->pipe_fd, &len, sizeof(uint32_t)) < 0) {
g_warning("failed to read rpc response: %s", strerror(errno));
return NULL;

View File

@@ -228,6 +228,7 @@ test_searpc__simple_call (void)
2, "string", "hello", "int", 10);
cl_assert (error->message);
g_free (result);
g_error_free(error);
}
void
@@ -240,6 +241,7 @@ test_searpc__invalid_call (void)
2, "string", "hello", "int", 2);
cl_assert (error != NULL);
g_free (result);
g_error_free (error);
}
GObject *
@@ -384,6 +386,7 @@ void simple_callback_error (void *result, void *user_data, GError *error)
{
cl_assert (result == NULL);
cl_assert (error != NULL);
g_error_free (error);
}
void