作図ソフト dia の改良版
Revisión | 0752d3219e9d36746939f5dc0e0d595119025a3c (tree) |
---|---|
Tiempo | 2014-09-05 20:55:36 |
Autor | Hans Breuer <hans@breu...> |
Commiter | Hans Breuer |
[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.
@@ -140,8 +140,14 @@ static void | ||
140 | 140 | renderer_finalize (GObject *object) |
141 | 141 | { |
142 | 142 | DiaRenderer *renderer = DIA_RENDERER (object); |
143 | + DiaImportRenderer *self = DIA_IMPORT_RENDERER (renderer); | |
143 | 144 | |
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 | + } | |
145 | 151 | |
146 | 152 | G_OBJECT_CLASS (parent_class)->finalize (object); |
147 | 153 | } |
@@ -392,8 +398,8 @@ fill_arc (DiaRenderer *renderer, Point *center, | ||
392 | 398 | real width, real height, real angle1, real angle2, |
393 | 399 | Color *color) |
394 | 400 | { |
395 | - DiaImportRenderer *self = DIA_IMPORT_RENDERER (renderer); | |
396 | 401 | #if 0 /* does not work till 'Standard - Arc' supports filling */ |
402 | + DiaImportRenderer *self = DIA_IMPORT_RENDERER (renderer); | |
397 | 403 | DiaObject *object = _make_arc (center, width, height, angle1, angle2); |
398 | 404 | |
399 | 405 | _apply_style (self, object, color, NULL, 0.0); |