[gimp] fix a few potential use-before-check errors
- From: Simon Budig <simon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] fix a few potential use-before-check errors
- Date: Fri, 15 Aug 2014 23:01:22 +0000 (UTC)
commit 7928be2255ae84c81b7762a53b63a9562cf75449
Author: Simon Budig <simon budig de>
Date: Sat Aug 16 00:29:16 2014 +0200
fix a few potential use-before-check errors
Spotted by Andrey Karpov using static code analysis:
http://www.viva64.com/en/b/0273/
plug-ins/common/sample-colorize.c | 2 +-
plug-ins/file-psd/psd-load.c | 3 +--
plug-ins/imagemap/imap_object.c | 4 +++-
3 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/plug-ins/common/sample-colorize.c b/plug-ins/common/sample-colorize.c
index 8aa4281..f4310a1 100644
--- a/plug-ins/common/sample-colorize.c
+++ b/plug-ins/common/sample-colorize.c
@@ -893,7 +893,7 @@ update_preview (gint32 *id_ptr)
if (g_Sdebug)
printf ("UPD PREVIEWS ID:%d ENABLE_UPD:%d\n",
- (int)*id_ptr, (int)g_di.enable_preview_update);
+ id_ptr ? (int) *id_ptr : -1, (int)g_di.enable_preview_update);
if (id_ptr == NULL || !g_di.enable_preview_update)
return;
diff --git a/plug-ins/file-psd/psd-load.c b/plug-ins/file-psd/psd-load.c
index ee82be1..373608d 100644
--- a/plug-ins/file-psd/psd-load.c
+++ b/plug-ins/file-psd/psd-load.c
@@ -1505,8 +1505,7 @@ add_layers (gint32 image_id,
gimp_layer_set_apply_mask (layer_id,
! lyr_a[lidx]->layer_mask.mask_flags.disabled);
}
- if (pixels)
- g_free (pixels);
+ g_free (pixels);
}
}
for (cidx = 0; cidx < lyr_a[lidx]->num_channels; ++cidx)
diff --git a/plug-ins/imagemap/imap_object.c b/plug-ins/imagemap/imap_object.c
index 786dc02..65a4653 100644
--- a/plug-ins/imagemap/imap_object.c
+++ b/plug-ins/imagemap/imap_object.c
@@ -533,9 +533,11 @@ ObjectList_t*
object_list_append_list(ObjectList_t *des, ObjectList_t *src)
{
GList *p;
+ if (!src)
+ return des;
for (p = src->list; p; p = p->next)
object_list_append(des, object_clone((Object_t*) p->data));
- object_list_set_changed(des, (src) ? TRUE : FALSE);
+ object_list_set_changed(des, TRUE);
return des;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]