Commit 21dd0467 authored by Lauri Kenttä's avatar Lauri Kenttä Committed by Alexandre Julliard

cmd: Fix memory leak in WCMD_reduce.

parent 0ea8893e
...@@ -3689,7 +3689,7 @@ static WCHAR WCMD_popoperator(OPSTACK **opstack) { ...@@ -3689,7 +3689,7 @@ static WCHAR WCMD_popoperator(OPSTACK **opstack) {
* Returns non-zero on error. * Returns non-zero on error.
*/ */
static int WCMD_reduce(OPSTACK **opstack, VARSTACK **varstack) { static int WCMD_reduce(OPSTACK **opstack, VARSTACK **varstack) {
OPSTACK *thisop; WCHAR thisop;
int var1,var2; int var1,var2;
int rc = 0; int rc = 0;
...@@ -3699,13 +3699,12 @@ static int WCMD_reduce(OPSTACK **opstack, VARSTACK **varstack) { ...@@ -3699,13 +3699,12 @@ static int WCMD_reduce(OPSTACK **opstack, VARSTACK **varstack) {
} }
/* Remove the top operator */ /* Remove the top operator */
thisop = *opstack; thisop = WCMD_popoperator(opstack);
*opstack = (*opstack)->next; WINE_TRACE("Reducing the stacks - processing operator %c\n", thisop);
WINE_TRACE("Reducing the stacks - processing operator %c\n", thisop->op);
/* One variable operators */ /* One variable operators */
var1 = WCMD_popnumber(varstack); var1 = WCMD_popnumber(varstack);
switch (thisop->op) { switch (thisop) {
case '!': WCMD_pushnumber(NULL, !var1, varstack); case '!': WCMD_pushnumber(NULL, !var1, varstack);
break; break;
case '~': WCMD_pushnumber(NULL, ~var1, varstack); case '~': WCMD_pushnumber(NULL, ~var1, varstack);
...@@ -3721,7 +3720,7 @@ static int WCMD_reduce(OPSTACK **opstack, VARSTACK **varstack) { ...@@ -3721,7 +3720,7 @@ static int WCMD_reduce(OPSTACK **opstack, VARSTACK **varstack) {
WINE_TRACE("No operands left for the reduce?\n"); WINE_TRACE("No operands left for the reduce?\n");
return WCMD_NOOPERAND; return WCMD_NOOPERAND;
} }
switch (thisop->op) { switch (thisop) {
case '!': case '!':
case '~': case '~':
case OP_POSITIVE: case OP_POSITIVE:
...@@ -3792,11 +3791,11 @@ static int WCMD_reduce(OPSTACK **opstack, VARSTACK **varstack) { ...@@ -3792,11 +3791,11 @@ static int WCMD_reduce(OPSTACK **opstack, VARSTACK **varstack) {
/* Make the operand stack grow by pushing the assign operator plus the /* Make the operand stack grow by pushing the assign operator plus the
operator to perform */ operator to perform */
while (calcassignments[i].op != ' ' && while (calcassignments[i].op != ' ' &&
calcassignments[i].calculatedop != thisop->op) { calcassignments[i].calculatedop != thisop) {
i++; i++;
} }
if (calcassignments[i].calculatedop == ' ') { if (calcassignments[i].calculatedop == ' ') {
WINE_ERR("Unexpected operator %c\n", thisop->op); WINE_ERR("Unexpected operator %c\n", thisop);
return WCMD_NOOPERATOR; return WCMD_NOOPERATOR;
} }
WCMD_pushoperator('=', WCMD_getprecedence('='), opstack); WCMD_pushoperator('=', WCMD_getprecedence('='), opstack);
...@@ -3820,10 +3819,9 @@ static int WCMD_reduce(OPSTACK **opstack, VARSTACK **varstack) { ...@@ -3820,10 +3819,9 @@ static int WCMD_reduce(OPSTACK **opstack, VARSTACK **varstack) {
break; break;
} }
default: WINE_ERR("Unrecognized operator %c\n", thisop->op); default: WINE_ERR("Unrecognized operator %c\n", thisop);
} }
heap_free(thisop);
return rc; return rc;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment