From 1174c7d6628de721052190167e249f251a8bbbe5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 17 Mar 2013 10:15:06 +0000 Subject: fix for missing NULL pointer checks and incorrect array free --- source/blender/editors/sculpt_paint/paint_image_2d.c | 4 ++-- source/blender/imbuf/intern/dds/FlipDXT.cpp | 2 +- source/blender/makesrna/intern/rna_object_force.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index 8db1b1817b5..ed1b25d1b4e 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -704,7 +704,7 @@ int paint_2d_stroke(void *ps, const int prev_mval[2], const int mval[2], int era ImagePaintState *s = ps; BrushPainter *painter = s->painter; ImBuf *ibuf = BKE_image_acquire_ibuf(s->image, s->sima ? &s->sima->iuser : NULL, NULL); - int is_data = ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA; + const bool is_data = (ibuf && ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA); if (!ibuf) return 0; @@ -739,7 +739,7 @@ int paint_2d_stroke(void *ps, const int prev_mval[2], const int mval[2], int era brush_painter_2d_require_imbuf(painter, ((ibuf->rect_float) ? 1 : 0), 0, 0); if (painter->cache.enabled) - brush_painter_2d_refresh_cache(painter, newuv, is_data == FALSE); + brush_painter_2d_refresh_cache(painter, newuv, is_data == false); if (paint_2d_op(s, painter->cache.ibuf, olduv, newuv)) { imapaint_image_update(s->sima, s->image, ibuf, false); diff --git a/source/blender/imbuf/intern/dds/FlipDXT.cpp b/source/blender/imbuf/intern/dds/FlipDXT.cpp index 660643530ba..4f63d17dc90 100644 --- a/source/blender/imbuf/intern/dds/FlipDXT.cpp +++ b/source/blender/imbuf/intern/dds/FlipDXT.cpp @@ -241,7 +241,7 @@ int FlipDXTCImage(unsigned int width, unsigned int height, unsigned int levels, memcpy(line2, temp_line, row_bytes); } - delete temp_line; + delete[] temp_line; } // mip levels are contiguous. diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 5ebc3f25c22..ab8b54334fe 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -483,7 +483,7 @@ static void rna_FieldSettings_update(Main *UNUSED(bmain), Scene *UNUSED(scene), part->pd->tex = NULL; } - if (part->pd2->forcefield != PFIELD_TEXTURE && part->pd2->tex) { + if (part->pd2 && part->pd2->forcefield != PFIELD_TEXTURE && part->pd2->tex) { part->pd2->tex->id.us--; part->pd2->tex = NULL; } -- cgit v1.2.3