Skip to content

Commit

Permalink
Proper HEP free upon failures
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdan-iancu committed May 22, 2017
1 parent 1fea1d7 commit eb0e471
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions mi/mi_trace.c
Expand Up @@ -211,15 +211,15 @@ int trace_mi_message(union sockaddr_union* src, union sockaddr_union* dst,
if ( correlation_id < 0 || correlation_vendor < 0 ) {
if ( load_correlation_id() < 0 ) {
LM_ERR("can't load correlation id!\n");
return -1;
goto error;
}
}

if ( mi_trace_api->add_chunk( message, correlation_value->s,
correlation_value->len, TRACE_TYPE_STR,
correlation_id, correlation_vendor) < 0 ) {
LM_ERR("can't set the correlation id!\n");
return -1;
goto error;
}
}

Expand All @@ -245,12 +245,15 @@ int trace_mi_message(union sockaddr_union* src, union sockaddr_union* dst,

if (mi_trace_api->send_message(message, trace_dst, 0) < 0) {
LM_ERR("failed to send trace message!\n");
return -1;
goto error;
}

mi_trace_api->free_message(message);

return 0;
error:
mi_trace_api->free_message(message);
return -1;
}

int load_correlation_id(void)
Expand Down

0 comments on commit eb0e471

Please sign in to comment.