Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Coverity] Fix resource leak #396

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions c/src/ml-api-remote-service.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ _mlrs_process_remote_service (nns_edge_data_h data_h)
{
void *data;
nns_size_t data_len;
gchar *service_str = NULL;
gchar *service_key = NULL;
g_autofree gchar *service_str = NULL;
g_autofree gchar *service_key = NULL;
ml_remote_service_type_e service_type;
int ret = NNS_EDGE_ERROR_NONE;

Expand Down Expand Up @@ -344,6 +344,7 @@ _mlrs_process_remote_service (nns_edge_data_h data_h)
GByteArray *array = g_byte_array_new ();

if (!_mlrs_get_data_from_uri ((gchar *) data, array)) {
g_byte_array_free (array, TRUE);
_ml_error_report_return (NNS_EDGE_ERROR_IO,
"Failed to get data from uri: %s.", (gchar *) data);
}
Expand All @@ -370,6 +371,7 @@ _mlrs_process_remote_service (nns_edge_data_h data_h)

ret = _mlrs_get_data_from_uri ((gchar *) data, array);
if (!ret) {
g_byte_array_free (array, TRUE);
_ml_error_report_return (ret,
"Failed to get data from uri: %s.", (gchar *) data);
}
Expand Down Expand Up @@ -409,8 +411,6 @@ _mlrs_edge_event_cb (nns_edge_event_h event_h, void *user_data)
return ret;

ret = _mlrs_process_remote_service (data_h);
if (NNS_EDGE_ERROR_NONE != ret)
return ret;
break;
}
default:
Expand Down
Loading