• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

作図ソフト dia の改良版


Commit MetaInfo

Revision0752d3219e9d36746939f5dc0e0d595119025a3c (tree)
Zeit2014-09-05 20:55:36
AutorHans Breuer <hans@breu...>
CommiterHans Breuer

Log Message

[scan-build] Fix potential memory leak

Value stored to 'renderer' during its initialization is never read
File: /home/hb/from-git/dia/lib/diaimportrenderer.c
Line: 142

A user of DiaImportRenderer which would not call
dia_import_renderer_get_objects() after importing the data would
have leaked all the objects.

Ändern Zusammenfassung

Diff

--- a/lib/diaimportrenderer.c
+++ b/lib/diaimportrenderer.c
@@ -140,8 +140,14 @@ static void
140140 renderer_finalize (GObject *object)
141141 {
142142 DiaRenderer *renderer = DIA_RENDERER (object);
143+ DiaImportRenderer *self = DIA_IMPORT_RENDERER (renderer);
143144
144- /* XXX: anything to destroy */
145+ /* anything more to destroy? */
146+ if (self->objects) {
147+ /* if no one called dia_import_renderer_get_objects() */
148+ destroy_object_list(self->objects);
149+ self->objects = NULL;
150+ }
145151
146152 G_OBJECT_CLASS (parent_class)->finalize (object);
147153 }
@@ -392,8 +398,8 @@ fill_arc (DiaRenderer *renderer, Point *center,
392398 real width, real height, real angle1, real angle2,
393399 Color *color)
394400 {
395- DiaImportRenderer *self = DIA_IMPORT_RENDERER (renderer);
396401 #if 0 /* does not work till 'Standard - Arc' supports filling */
402+ DiaImportRenderer *self = DIA_IMPORT_RENDERER (renderer);
397403 DiaObject *object = _make_arc (center, width, height, angle1, angle2);
398404
399405 _apply_style (self, object, color, NULL, 0.0);