rv = _connection_libnet_init(*connection);
if (rv == NET_ERR_ACCESS_DENIED) {
CONNECTION_LOG(CONNECTION_ERROR, "Access denied"); //LCOV_EXCL_LINE
+ g_free(*connection);
+ *connection = NULL;
+
CONN_UNLOCK; //LCOV_EXCL_LINE
return CONNECTION_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
} else if (rv != NET_ERR_NONE) {
CONNECTION_LOG(CONNECTION_ERROR, "Failed to create connection[%d]", rv); //LCOV_EXCL_LINE
+ g_free(*connection);
+ *connection = NULL;
+
CONN_UNLOCK; //LCOV_EXCL_LINE
return CONNECTION_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
}