mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-12-02 03:58:33 +08:00
fix memory leak found by valgrind
This commit is contained in:
parent
3f462ca37b
commit
276e38f25b
@ -207,6 +207,8 @@ static gradient_t* gradient_parse_str(gradient_t* gradient, const char* str) {
|
||||
t->cursor++;
|
||||
gradient_parse_radial(gradient, t);
|
||||
}
|
||||
tokenizer_deinit(t);
|
||||
|
||||
return gradient;
|
||||
}
|
||||
|
||||
|
@ -619,7 +619,9 @@ ret_t value_reset(value_t* v) {
|
||||
TKMEM_FREE(v->value.sized_str.str);
|
||||
break;
|
||||
}
|
||||
case VALUE_TYPE_BINARY: {
|
||||
case VALUE_TYPE_BINARY:
|
||||
case VALUE_TYPE_UBJSON:
|
||||
case VALUE_TYPE_GRADIENT: {
|
||||
TKMEM_FREE(v->value.binary_data.data);
|
||||
break;
|
||||
}
|
||||
|
@ -24,6 +24,8 @@ static ret_t on_style_item(void* ctx, const char* widget_state, const char* id,
|
||||
gradient_to_str(&g, &s);
|
||||
|
||||
snprintf(str, sizeof(str), "%s,%s,\"%s\";", widget_state, id, s.str);
|
||||
gradient_deinit(&g);
|
||||
str_reset(&s);
|
||||
} else {
|
||||
snprintf(str, sizeof(str), "%s,%s,%d;", widget_state, id, value_int(val));
|
||||
}
|
||||
|
@ -58,7 +58,6 @@ TEST(UILoaderXML, attr) {
|
||||
|
||||
ASSERT_EQ(builder->root != NULL, true);
|
||||
widget_layout(builder->root);
|
||||
ui_builder_destroy(builder);
|
||||
b1 = widget_lookup(builder->root, "b1", TRUE);
|
||||
ASSERT_EQ(b1 != NULL, true);
|
||||
ASSERT_EQ(b1->x, 10);
|
||||
@ -92,6 +91,7 @@ TEST(UILoaderXML, attr) {
|
||||
ASSERT_EQ(b4->h, 20);
|
||||
|
||||
widget_destroy(builder->root);
|
||||
ui_builder_destroy(builder);
|
||||
}
|
||||
|
||||
TEST(UILoaderXML, prop1) {
|
||||
|
Loading…
Reference in New Issue
Block a user