projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: lib: field.c: calling _PUT_REF() on unique objects on error
[babeltrace.git]
/
src
/
lib
/
trace-ir
/
field.c
diff --git
a/src/lib/trace-ir/field.c
b/src/lib/trace-ir/field.c
index 7f2225ddef8496d4e64da8ad2231e21a12273e87..e2e77cc7ca6a219dad7820af90d67da9e73c8be6 100644
(file)
--- a/
src/lib/trace-ir/field.c
+++ b/
src/lib/trace-ir/field.c
@@
-393,7
+393,8
@@
struct bt_field *create_string_field(struct bt_field_class *fc)
sizeof(char), 1);
if (!string_field->buf) {
BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GArray.");
sizeof(char), 1);
if (!string_field->buf) {
BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GArray.");
- BT_OBJECT_PUT_REF_AND_RESET(string_field);
+ bt_field_destroy((void *) string_field);
+ string_field = NULL;
goto end;
}
goto end;
}
@@
-462,7
+463,8
@@
struct bt_field *create_structure_field(struct bt_field_class *fc)
&struct_field->fields)) {
BT_LIB_LOGE_APPEND_CAUSE(
"Cannot create structure member fields: %![fc-]+F", fc);
&struct_field->fields)) {
BT_LIB_LOGE_APPEND_CAUSE(
"Cannot create structure member fields: %![fc-]+F", fc);
- BT_OBJECT_PUT_REF_AND_RESET(struct_field);
+ bt_field_destroy((void *) struct_field);
+ struct_field = NULL;
goto end;
}
goto end;
}
@@
-493,7
+495,8
@@
struct bt_field *create_option_field(struct bt_field_class *fc)
"Failed to create option field's content field: "
"%![opt-fc-]+F, %![content-fc-]+F",
opt_fc, opt_fc->content_fc);
"Failed to create option field's content field: "
"%![opt-fc-]+F, %![content-fc-]+F",
opt_fc, opt_fc->content_fc);
- BT_OBJECT_PUT_REF_AND_RESET(opt_field);
+ bt_field_destroy((void *) opt_field);
+ opt_field = NULL;
goto end;
}
goto end;
}
@@
-522,7
+525,8
@@
struct bt_field *create_variant_field(struct bt_field_class *fc)
&var_field->fields)) {
BT_LIB_LOGE_APPEND_CAUSE("Cannot create variant member fields: "
"%![fc-]+F", fc);
&var_field->fields)) {
BT_LIB_LOGE_APPEND_CAUSE("Cannot create variant member fields: "
"%![fc-]+F", fc);
- BT_OBJECT_PUT_REF_AND_RESET(var_field);
+ bt_field_destroy((void *) var_field);
+ var_field = NULL;
goto end;
}
goto end;
}
@@
-588,7
+592,8
@@
struct bt_field *create_static_array_field(struct bt_field_class *fc)
if (init_array_field_fields(array_field)) {
BT_LIB_LOGE_APPEND_CAUSE("Cannot create static array fields: "
"%![fc-]+F", fc);
if (init_array_field_fields(array_field)) {
BT_LIB_LOGE_APPEND_CAUSE("Cannot create static array fields: "
"%![fc-]+F", fc);
- BT_OBJECT_PUT_REF_AND_RESET(array_field);
+ bt_field_destroy((void *) array_field);
+ array_field = NULL;
goto end;
}
goto end;
}
@@
-616,7
+621,8
@@
struct bt_field *create_dynamic_array_field(struct bt_field_class *fc)
if (init_array_field_fields(array_field)) {
BT_LIB_LOGE_APPEND_CAUSE("Cannot create dynamic array fields: "
"%![fc-]+F", fc);
if (init_array_field_fields(array_field)) {
BT_LIB_LOGE_APPEND_CAUSE("Cannot create dynamic array fields: "
"%![fc-]+F", fc);
- BT_OBJECT_PUT_REF_AND_RESET(array_field);
+ bt_field_destroy((void *) array_field);
+ array_field = NULL;
goto end;
}
goto end;
}
This page took
0.024443 seconds
and
4
git commands to generate.