diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-03-17 14:15:06 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-03-17 14:15:06 +0400 |
commit | 1174c7d6628de721052190167e249f251a8bbbe5 (patch) | |
tree | a65c063e0e3b5e989549eb0603d313269586c09a /source | |
parent | a4e284091b27c8c4d1f4047a7a678c2fa6b13c0b (diff) |
fix for missing NULL pointer checks and incorrect array free
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image_2d.c | 4 | ||||
-rw-r--r-- | source/blender/imbuf/intern/dds/FlipDXT.cpp | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object_force.c | 2 |
3 files changed, 4 insertions, 4 deletions
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; } |