notification->condition = condition;
notification->evaluation = evaluation;
- notification->owns_elements = false;
end:
return notification;
}
LTTNG_HIDDEN
-int lttng_notification_serialize(struct lttng_notification *notification,
+int lttng_notification_serialize(const struct lttng_notification *notification,
struct lttng_dynamic_buffer *buf)
{
int ret;
header_offset = buf->size;
ret = lttng_dynamic_buffer_append(buf, ¬ification_comm,
sizeof(notification_comm));
+ if (ret) {
+ goto end;
+ }
size_before_payload = buf->size;
ret = lttng_condition_serialize(notification->condition,
goto error;
}
ret = notification_size;
- (*notification)->owns_elements = true;
end:
return ret;
error:
return;
}
- if (notification->owns_elements) {
- lttng_condition_destroy(notification->condition);
- lttng_evaluation_destroy(notification->evaluation);
- }
+ lttng_condition_destroy(notification->condition);
+ lttng_evaluation_destroy(notification->evaluation);
free(notification);
}