commit a5c7b51ed913a744c07bcd75ed837c85f74c2475
parent bc072c2d2e3fa688454936adc396e64031558650
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 4 Jan 2017 12:25:02 +0100
Fix several memory leaks
Diffstat:
4 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/core/solstice_core_node.c b/src/core/solstice_core_node.c
@@ -57,10 +57,9 @@ struct data {
struct ssol_instance* result;
};
-
/*******************************************************************************
-* Local functions
-******************************************************************************/
+ * Local functions
+ ******************************************************************************/
res_T
node_create
(struct score_device* dev,
diff --git a/src/solstice_entity.c b/src/solstice_entity.c
@@ -162,6 +162,7 @@ solstice_setup_entity
}
end:
+ if (instance) SSOL(instance_ref_put(instance));
if (out_node) *out_node = root_node;
return res;
diff --git a/src/solstice_material.c b/src/solstice_material.c
@@ -244,6 +244,8 @@ solstice_get_ssol_material
}
}
+ SSOL(material_ref_get(ssol_mtl));
+
exit:
*out_ssol_mtl = ssol_mtl;
return res;
diff --git a/src/solstice_object.c b/src/solstice_object.c
@@ -460,12 +460,17 @@ solstice_instantiate_geometry
res = create_shaded_shape(solstice, obj_id, &front, &back, &shape);
if(res != RES_OK) goto error;
+
res = ssol_object_add_shaded_shape(ssol_obj, shape, front, back);
if(res != RES_OK) {
fprintf(stderr,
"Could not add a shaded shape to a Solstice Solver object.\n");
goto error;
}
+
+ SSOL(shape_ref_put(shape));
+ SSOL(material_ref_put(front));
+ SSOL(material_ref_put(back));
}
}