summaryrefslogtreecommitdiffstats
path: root/src/object
diff options
context:
space:
mode:
authorMarc Jeanmougin <marc@jeanmougin.fr>2019-10-04 16:26:34 +0000
committerMarc Jeanmougin <marc@jeanmougin.fr>2019-10-05 10:35:21 +0000
commit95e00bdf7075329277cac97a6fd0a929c9a8e453 (patch)
treeff4521ff8f759eec5aac329efbf00bbca68f0d70 /src/object
parentFix segfault with bad SVG file. (diff)
downloadinkscape-95e00bdf7075329277cac97a6fd0a929c9a8e453.tar.gz
inkscape-95e00bdf7075329277cac97a6fd0a929c9a8e453.zip
Fix some memory leaks found by scan-build
Diffstat (limited to 'src/object')
-rw-r--r--src/object/box3d-side.cpp1
-rw-r--r--src/object/sp-text.cpp8
2 files changed, 5 insertions, 4 deletions
diff --git a/src/object/box3d-side.cpp b/src/object/box3d-side.cpp
index 6fcf22a9c..53b37f6c8 100644
--- a/src/object/box3d-side.cpp
+++ b/src/object/box3d-side.cpp
@@ -183,6 +183,7 @@ void Box3DSide::set_shape() {
!box3d_get_corner_screen(box, corners[3]).isFinite() )
{
g_warning ("Trying to draw a 3D box side with invalid coordinates.\n");
+ delete c;
return;
}
diff --git a/src/object/sp-text.cpp b/src/object/sp-text.cpp
index bf406601e..7786bf69c 100644
--- a/src/object/sp-text.cpp
+++ b/src/object/sp-text.cpp
@@ -767,8 +767,8 @@ unsigned SPText::_buildLayoutInput(SPObject *object, Inkscape::Text::Layout::Opt
Shape* SPText::_buildExclusionShape() const
{
- Shape *result = new Shape(); // Union of all exclusion shapes
- Shape *shape_temp = new Shape();
+ std::unique_ptr<Shape> result(new Shape()); // Union of all exclusion shapes
+ std::unique_ptr<Shape> shape_temp(new Shape());
for(auto shape_id : style->shape_subtract.shape_ids) {
@@ -799,7 +799,7 @@ Shape* SPText::_buildExclusionShape() const
uncross->ConvertToShape( sh );
if (result->hasEdges()) {
- shape_temp->Booleen(result, uncross, bool_op_union);
+ shape_temp->Booleen(result.get(), uncross, bool_op_union);
std::swap(result, shape_temp);
} else {
result->Copy(uncross);
@@ -807,7 +807,7 @@ Shape* SPText::_buildExclusionShape() const
}
}
}
- return result;
+ return result.release();
}