get rid of references to freed code.

This commit is contained in:
Vitor Santos Costa 2011-02-04 01:23:01 +00:00
parent 7fd6faea64
commit 9bdc7ca96e
4 changed files with 6 additions and 8 deletions

View File

@ -1258,6 +1258,8 @@ cleanup_dangling_indices(yamop *ipc, yamop *beg, yamop *end, yamop *suspend_code
case _switch_on_cons: case _switch_on_cons:
case _if_cons: case _if_cons:
case _go_on_cons: case _go_on_cons:
/* make sure we don't leave dangling references to memory that is going to be removed */
ipc->u.sssl.l = NULL;
ipc = NEXTOP(ipc,sssl); ipc = NEXTOP(ipc,sssl);
break; break;
case _op_fail: case _op_fail:
@ -1272,12 +1274,6 @@ cleanup_dangling_indices(yamop *ipc, yamop *beg, yamop *end, yamop *suspend_code
} }
} }
void
Yap_cleanup_dangling_indices(yamop *ipc, yamop *beg, yamop *end, yamop *sc)
{
cleanup_dangling_indices(ipc, beg, end, sc);
}
static void static void
decrease_log_indices(LogUpdIndex *c, yamop *suspend_code) decrease_log_indices(LogUpdIndex *c, yamop *suspend_code)
{ {

View File

@ -205,7 +205,6 @@ void STD_PROTO(Yap_IPred,(PredEntry *, UInt, yamop *));
int STD_PROTO(Yap_addclause,(Term,yamop *,int,Term,Term*)); int STD_PROTO(Yap_addclause,(Term,yamop *,int,Term,Term*));
void STD_PROTO(Yap_add_logupd_clause,(PredEntry *,LogUpdClause *,int)); void STD_PROTO(Yap_add_logupd_clause,(PredEntry *,LogUpdClause *,int));
void STD_PROTO(Yap_kill_iblock,(ClauseUnion *,ClauseUnion *,PredEntry *)); void STD_PROTO(Yap_kill_iblock,(ClauseUnion *,ClauseUnion *,PredEntry *));
void STD_PROTO(Yap_cleanup_dangling_indices,(yamop *,yamop *,yamop *,yamop *));
void STD_PROTO(Yap_EraseStaticClause,(StaticClause *, Term)); void STD_PROTO(Yap_EraseStaticClause,(StaticClause *, Term));
ClauseUnion *STD_PROTO(Yap_find_owner_index,(yamop *, PredEntry *)); ClauseUnion *STD_PROTO(Yap_find_owner_index,(yamop *, PredEntry *));

View File

@ -284,6 +284,9 @@ static void
AdjustSwitchTable(op_numbers op, yamop *table, COUNT i) AdjustSwitchTable(op_numbers op, yamop *table, COUNT i)
{ {
CELL *startcode = (CELL *)table; CELL *startcode = (CELL *)table;
/* in case the table is already gone */
if (!table)
return;
switch (op) { switch (op) {
case _switch_on_func: case _switch_on_func:
{ {

@ -1 +1 @@
Subproject commit 73e4e086d06c54210100f0faaeccbea276c707eb Subproject commit 29151b2fe68f2dc727cdc07040e1fa1ad4fcca20