Skip to content

Commit fd302c5

Browse files
committed
bytecode: In Classify, move Release before changing type
Release only works if it knows the actual type and has the right pointer Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
1 parent bb5a151 commit fd302c5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/bytecode.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ MACHINE_TYPE(natural, unsigned long, naught)
444444
case NATURAL:
445445
{
446446
Natural *xn = (Natural *) tree;
447+
Release(xn);
447448
if (xn->IsSigned())
448449
{
449450
type = integer_mtype;
@@ -454,20 +455,20 @@ MACHINE_TYPE(natural, unsigned long, naught)
454455
type = natural_mtype;
455456
as_natural = xn->value;
456457
}
457-
Release(xn);
458458
return *this;
459459
}
460460
case REAL:
461461
{
462462
Real *xr = (Real *) tree;
463+
Release(xr);
463464
type = real_mtype;
464465
as_real = xr->value;
465-
Release(xr);
466466
return *this;
467467
}
468468
case TEXT:
469469
{
470470
Text *xt = (Text *) tree;
471+
Release(xt);
471472
if (xt->IsCharacter())
472473
{
473474
type = character_mtype;
@@ -478,7 +479,6 @@ MACHINE_TYPE(natural, unsigned long, naught)
478479
type = text_mtype;
479480
as_text = new text(xt->value);
480481
}
481-
Release(xt);
482482
return *this;
483483
}
484484
case NAME:

0 commit comments

Comments
 (0)