diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index e455e4c59e0..83c51de76d1 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -2296,11 +2296,11 @@ void swapdata(void *adr1, void *adr2, int len) else { char *adr; - adr= (char *)malloc(len); + adr= (char *)MEM_mallocN(len, "curve swap"); memcpy(adr, adr1, len); memcpy(adr1, adr2, len); memcpy(adr2, adr, len); - free(adr); + MEM_freeN(adr); } } diff --git a/source/blender/blenkernel/intern/exotic.c b/source/blender/blenkernel/intern/exotic.c index 08f29f6e524..082a02277d6 100644 --- a/source/blender/blenkernel/intern/exotic.c +++ b/source/blender/blenkernel/intern/exotic.c @@ -373,7 +373,7 @@ static void read_stl_mesh_ascii(char *str) * i.e. 30000 verts, i.e., 90000 floats. */ numtenthousand = 1; - vertdata = malloc(numtenthousand*3*30000*sizeof(float)); + vertdata = malloc(numtenthousand*3*30000*sizeof(float)); // uses realloc! if (!vertdata) STLALLOCERROR; linenum = 1; diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index d81c5f46e61..3dfc96d7ebe 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -1820,14 +1820,14 @@ static void editing_panel_armature_bones(Object *ob, bArmature *arm) uiDefBut(block, LABEL, 0, "child of", bx+107,by,73,18, NULL, 0.0, 0.0, 0.0, 0.0, ""); - boneString = malloc((BLI_countlist(&G.edbo) * 64)+64); + boneString = MEM_mallocN((BLI_countlist(&G.edbo) * 64)+64, "Bone str"); build_bonestring (boneString, curBone); curBone->parNr = editbone_to_parnr(curBone->parent); but = uiDefButI(block, MENU,REDRAWVIEW3D, boneString, bx+180,by,120,18, &curBone->parNr, 0.0, 0.0, 0.0, 0.0, "Parent"); uiButSetFunc(but, parnr_to_editbone_cb, curBone, NULL); - free(boneString); + MEM_freeN(boneString); /* IK to parent flag */ if (curBone->parent){ diff --git a/source/blender/src/playanim.c b/source/blender/src/playanim.c index c9b125f10cc..0e4f0bd58e9 100644 --- a/source/blender/src/playanim.c +++ b/source/blender/src/playanim.c @@ -249,7 +249,7 @@ static void build_pict_list(char * first) while(IMB_ispic(name)){ file = open(name, O_BINARY|O_RDONLY, 0); if (file < 0) return; - picture = (struct pict*)calloc(1, sizeof(struct pict)); + picture = (struct pict*)MEM_callocN(sizeof(struct pict), "picture"); if (picture == 0){ printf("Not enough memory for pict struct \n"); close(file); @@ -260,19 +260,19 @@ static void build_pict_list(char * first) picture->IB_flags = IB_rect; if (fromdisk == FALSE) { - mem=(char *)malloc(size); + mem=(char *)MEM_mallocN(size, "build pic list"); if (mem==0){ printf("Couldn't get memory\n"); close(file); - free(picture); + MEM_freeN(picture); return; } if (read(file,mem,size) != size){ printf("Error while reading %s\n",name); close(file); - free(picture); - free(mem); + MEM_freeN(picture); + MEM_freeN(mem); return; } } else mem = 0; diff --git a/source/blender/src/swapbuffers.c b/source/blender/src/swapbuffers.c index 8e106f52fa2..cad8d86e677 100644 --- a/source/blender/src/swapbuffers.c +++ b/source/blender/src/swapbuffers.c @@ -69,7 +69,7 @@ static void copy_back_to_front(void) winlay_get_winsize(&winx, &winy); if (actually_swap) { - data= malloc(4*winx*winy); + data= MEM_mallocN(4*winx*winy, "swap"); glReadPixels(0, 0, winx, winy, GL_RGBA, GL_UNSIGNED_BYTE, data); } @@ -85,7 +85,7 @@ static void copy_back_to_front(void) glRasterPos2f(-0.5,-0.5); glDrawPixels(winx, winy, GL_RGBA, GL_UNSIGNED_BYTE, data); glFlush(); - free(data); + MEM_freeN(data); } } #endif diff --git a/source/blender/src/writeavicodec.c b/source/blender/src/writeavicodec.c index 5c9ddc9ec57..8e9ee8932aa 100644 --- a/source/blender/src/writeavicodec.c +++ b/source/blender/src/writeavicodec.c @@ -564,12 +564,12 @@ static void acd_to_opts(AviCodecData *acd) opts.cbParms = acd->cbParms; if (acd->lpFormat && acd->cbFormat) { - opts.lpFormat = malloc(opts.cbFormat); + opts.lpFormat = MEM_mallocN(opts.cbFormat, "opts lpFormat"); memcpy(opts.lpFormat, acd->lpFormat, opts.cbFormat); } if (acd->lpParms && acd->cbParms) { - opts.lpParms = malloc(opts.cbParms); + opts.lpParms = MEM_mallocN(opts.cbParms, "opts.cbParms"); memcpy(opts.lpParms, acd->lpParms, opts.cbParms); } } @@ -578,11 +578,11 @@ static void acd_to_opts(AviCodecData *acd) static void free_opts_data() { if (opts.lpFormat) { - free(opts.lpFormat); + MEM_freeN(opts.lpFormat); opts.lpFormat = NULL; } if (opts.lpParms) { - free(opts.lpParms); + MEM_freeN(opts.lpParms); opts.lpParms = NULL; } }