Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-03-01 13:14:20 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-03-01 13:14:20 +0400
commit973771723414e49709c100b1c3a48c7bdeb51cdd (patch)
treed8f1aaf5ef07cc4b748e5176039970771379ac3a /source/blender
parent9742a6f6cb053ff45060f4bb5f5fa96084b7f5b5 (diff)
Fix for some unlikely memory leaks, remove redundant checks
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/navmesh_conversion.c8
-rw-r--r--source/blender/blenlib/intern/scanfill_utils.c5
-rw-r--r--source/blender/editors/space_text/text_draw.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c2
-rw-r--r--source/blender/editors/transform/transform_conversions.c7
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.c6
-rw-r--r--source/blender/editors/uvedit/uvedit_parametrizer.h4
-rw-r--r--source/blender/imbuf/intern/targa.c3
8 files changed, 24 insertions, 15 deletions
diff --git a/source/blender/blenkernel/intern/navmesh_conversion.c b/source/blender/blenkernel/intern/navmesh_conversion.c
index 3c499908bf7..28ef1180f53 100644
--- a/source/blender/blenkernel/intern/navmesh_conversion.c
+++ b/source/blender/blenkernel/intern/navmesh_conversion.c
@@ -400,7 +400,7 @@ int buildNavMeshData(const int nverts, const float *verts,
if (curpolyidx != prevpolyidx) {
if (curpolyidx != prevpolyidx + 1) {
printf("Converting navmesh: Error! Wrong order of detailed mesh faces\n");
- return 0;
+ goto fail;
}
dmesh = dmesh == NULL ? dmeshes : dmesh + 4;
dmesh[2] = (unsigned short)i; /* tbase */
@@ -427,6 +427,12 @@ int buildNavMeshData(const int nverts, const float *verts,
*dtrisToTrisMap_r = dtrisToTrisMap;
return 1;
+
+fail:
+ MEM_freeN(dmeshes);
+ MEM_freeN(dtrisToPolysMap);
+ MEM_freeN(dtrisToTrisMap);
+ return 0;
}
diff --git a/source/blender/blenlib/intern/scanfill_utils.c b/source/blender/blenlib/intern/scanfill_utils.c
index c3c68717025..4bee16319f3 100644
--- a/source/blender/blenlib/intern/scanfill_utils.c
+++ b/source/blender/blenlib/intern/scanfill_utils.c
@@ -46,11 +46,6 @@ typedef struct PolyInfo {
ScanFillVert *vert_outer;
} PolyInfo;
-typedef struct PolySort {
- float area;
- unsigned short poly_nr;
-} PolySort;
-
typedef struct ScanFillIsect {
struct ScanFillIsect *next, *prev;
float co[3];
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 4504963a572..f25e09a905d 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -822,7 +822,7 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
/* the scrollbar is non-linear sized */
if (pix_bardiff > 0) {
/* the start of the highlight is in the current viewport */
- if (ltexth && st->viewlines && lhlstart >= st->top && lhlstart <= st->top + st->viewlines) {
+ if (st->viewlines && lhlstart >= st->top && lhlstart <= st->top + st->viewlines) {
/* speed the progresion of the start of the highlight through the scrollbar */
hlstart = ( ( (pix_available - pix_bardiff) * lhlstart) / ltexth) + (pix_bardiff * (lhlstart - st->top) / st->viewlines);
}
@@ -840,7 +840,7 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
}
/* the end of the highlight is in the current viewport */
- if (ltexth && st->viewlines && lhlend >= st->top && lhlend <= st->top + st->viewlines) {
+ if (st->viewlines && lhlend >= st->top && lhlend <= st->top + st->viewlines) {
/* speed the progresion of the end of the highlight through the scrollbar */
hlend = (((pix_available - pix_bardiff) * lhlend) / ltexth) + (pix_bardiff * (lhlend - st->top) / st->viewlines);
}
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index cb137ff7746..4220bcf161b 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1217,7 +1217,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
vmargin = 0.035f * (y2 - y1);
uiDrawBox(GL_LINE_LOOP, x1 + hmargin, y1 + vmargin, x2 - hmargin, y2 - vmargin, 2.0f);
}
- if (ca && (ca->flag & CAM_SHOWSENSOR)) {
+ if (ca->flag & CAM_SHOWSENSOR) {
/* determine sensor fit, and get sensor x/y, for auto fit we
* assume and square sensor and only use sensor_x */
float sizex = scene->r.xsch * scene->r.xasp;
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index dabe4c684ab..beb49a5443e 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -2636,7 +2636,12 @@ static void createTransUVs(bContext *C, TransInfo *t)
}
/* note: in prop mode we need at least 1 selected */
- if (countsel == 0) return;
+ if (countsel == 0) {
+ if (propconnected) {
+ MEM_freeN(island_enabled);
+ }
+ return;
+ }
t->total = (propmode) ? count : countsel;
t->data = MEM_callocN(t->total * sizeof(TransData), "TransObData(UV Editing)");
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index 105f3a835f3..7150d74c32c 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -200,7 +200,7 @@ typedef struct PChart {
} lscm;
struct PChartPack {
float rescale, area;
- float size[2], trans[2];
+ float size[2] /* , trans[2] */;
} pack;
} u;
@@ -1100,7 +1100,7 @@ static PFace *p_face_add(PHandle *handle)
}
static PFace *p_face_add_construct(PHandle *handle, ParamKey key, ParamKey *vkeys,
- float *co[3], float *uv[3], int i1, int i2, int i3,
+ float *co[4], float *uv[4], int i1, int i2, int i3,
ParamBool *pin, ParamBool *select)
{
PFace *f = p_face_add(handle);
@@ -4250,7 +4250,7 @@ static void p_add_ngon(ParamHandle *handle, ParamKey key, int nverts,
}
void param_face_add(ParamHandle *handle, ParamKey key, int nverts,
- ParamKey *vkeys, float **co, float **uv,
+ ParamKey *vkeys, float *co[4], float *uv[4],
ParamBool *pin, ParamBool *select, float normal[3])
{
PHandle *phandle = (PHandle *)handle;
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.h b/source/blender/editors/uvedit/uvedit_parametrizer.h
index 265577555a6..eaea781971d 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.h
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.h
@@ -59,8 +59,8 @@ void param_face_add(ParamHandle *handle,
ParamKey key,
int nverts,
ParamKey *vkeys,
- float **co,
- float **uv,
+ float *co[4],
+ float *uv[4],
ParamBool *pin,
ParamBool *select,
float face_normal[3]);
diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c
index 7e6116b242c..6dbd7a4027e 100644
--- a/source/blender/imbuf/intern/targa.c
+++ b/source/blender/imbuf/intern/targa.c
@@ -618,6 +618,9 @@ ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags, char colors
}
if (flags & IB_test) {
+ if (cmap) {
+ MEM_freeN(cmap);
+ }
return ibuf;
}