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>2011-11-28 09:00:34 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-11-28 09:00:34 +0400
commit969895a0bc4708955ad6f5fe331ce96ec90b9233 (patch)
tree419f1bae3a3ac7fb591a4fac605fa8f6307fffc6 /source/blender
parent52558fbe2ebfcfa6d60341da02bb33a264846660 (diff)
fix for minor memory leak for BMO_VInitOpf() in an error case, also use the BLI version of strdup().
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c
index 7c731f8aa56..8d1d92ce630 100644
--- a/source/blender/bmesh/intern/bmesh_operators.c
+++ b/source/blender/bmesh/intern/bmesh_operators.c
@@ -1126,14 +1126,14 @@ int BMO_VInitOpf(BMesh *bm, BMOperator *op, const char *_fmt, va_list vlist)
int noslot=0;
/*we muck around in here, so dup it*/
- fmt = ofmt = strdup(fmt);
+ fmt = ofmt = BLI_strdup(fmt);
/*find operator name*/
i = strcspn(fmt, " \t");
opname = fmt;
if (!opname[i]) noslot = 1;
- opname[i] = 0;
+ opname[i] = '\0';
fmt += i + (noslot ? 0 : 1);
@@ -1141,8 +1141,11 @@ int BMO_VInitOpf(BMesh *bm, BMOperator *op, const char *_fmt, va_list vlist)
if (!strcmp(opname, opdefines[i]->name)) break;
}
- if (i == bmesh_total_ops) return 0;
-
+ if (i == bmesh_total_ops) {
+ MEM_freeN(ofmt);
+ return 0;
+ }
+
BMO_Init_Op(bm, op, opname);
def = opdefines[i];
@@ -1272,7 +1275,7 @@ int BMO_VInitOpf(BMesh *bm, BMOperator *op, const char *_fmt, va_list vlist)
fmt++;
}
- free(ofmt);
+ MEM_freeN(ofmt);
return 1;
error:
BMO_Finish_Op(bm, op);