Skip to content

Commit 1168604

Browse files
committed
fix attribute memleak
1 parent d22f875 commit 1168604

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/sentry_value.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,6 @@ sentry_value_t
513513
sentry_value_new_attribute_n(
514514
sentry_value_t value, const char *unit, size_t unit_len)
515515
{
516-
sentry_value_t attribute = sentry_value_new_object();
517516
char *type;
518517
switch (sentry_value_get_type(value)) {
519518
case SENTRY_VALUE_TYPE_BOOL:
@@ -537,6 +536,8 @@ sentry_value_new_attribute_n(
537536
sentry_value_decref(value);
538537
return sentry_value_new_null();
539538
}
539+
sentry_value_t attribute = sentry_value_new_object();
540+
540541
sentry_value_set_by_key(
541542
attribute, "type", sentry_value_new_string_n(type, strlen(type)));
542543
sentry_value_set_by_key(attribute, "value", value);

0 commit comments

Comments
 (0)