(gdb) bt
#0 0xb7d262ae in strcasecmp () from /lib/libc.so.6
#1 0xb7d26281 in strcasecmp () from /lib/libc.so.6
bool spec_mage_defend( CHAR_DATA * ch )
{
char *spell;
int sn;
if( ch->position == POS_FIGHTING)
return FALSE;
for( ;; )
{
int min_level;
switch ( number_bits( 4 ) )
{
case 0:
min_level = 0;
spell = "armor";
break;
case 1:
min_level = 8;
spell = "kindred strength";
break;
case 2:
min_level = 17;
if ( !IS_AFFECTED (ch, AFF_HASTE))
spell = "haste";
break;
default:
min_level = 20;
if ( !IS_AFFECTED (ch, AFF_SHOCKSHIELD))
spell = "shockshield";
break;
}
if( ch->level >= min_level )
break;
}
if( ( sn = skill_lookup( spell ) ) < 0 )
return FALSE;
do_cast(ch, spell);
return TRUE;
}
==4632== Conditional jump or move depends on uninitialised value(s)
==4632== at 0x82353E1: spec_cleric_defend (special.c:1375)
==4632== by 0x8245F50: mobile_update() (update.c:860)
==4632== by 0x8248D90: update_handler() (update.c:2323)
==4632== by 0x814648A: game_loop() (comm.c:873)
==4632== by 0x8148353: main (comm.c:531)
==4632==
==4632== Conditional jump or move depends on uninitialised value(s)
==4632== at 0x41E129B: strcasecmp (in /lib/libc-2.8.90.so)
==4632== by 0x81B6814: bsearch_skill_exact(char const*, int, int) (magic.c:291)
==4632== by 0x81B70A5: skill_lookup(char const*) (magic.c:161)
==4632== by 0x82354E8: spec_mage_defend (special.c:1227)
==4632== by 0x8245F32: mobile_update() (update.c:850)
==4632== by 0x8248D90: update_handler() (update.c:2323)
==4632== by 0x814648A: game_loop() (comm.c:873)
==4632== by 0x8148353: main (comm.c:531)
==4632==
==4632== Use of uninitialised value of size 4
==4632== at 0x41E12AE: strcasecmp (in /lib/libc-2.8.90.so)
==4632== by 0x81B6814: bsearch_skill_exact(char const*, int, int) (magic.c:291)
==4632== by 0x81B70A5: skill_lookup(char const*) (magic.c:161)
==4632== by 0x82354E8: spec_mage_defend (special.c:1227)
==4632== by 0x8245F32: mobile_update() (update.c:850)
==4632== by 0x8248D90: update_handler() (update.c:2323)
==4632== by 0x814648A: game_loop() (comm.c:873)
==4632== by 0x8148353: main (comm.c:531)
==4632==
==4632== Invalid read of size 1
==4632== at 0x41E12AE: strcasecmp (in /lib/libc-2.8.90.so)
==4632== by 0x81B6814: bsearch_skill_exact(char const*, int, int) (magic.c:291)
==4632== by 0x81B70A5: skill_lookup(char const*) (magic.c:161)
==4632== by 0x82354E8: spec_mage_defend (special.c:1227)
==4632== by 0x8245F32: mobile_update() (update.c:850)
==4632== by 0x8248D90: update_handler() (update.c:2323)
==4632== by 0x814648A: game_loop() (comm.c:873)
==4632== by 0x8148353: main (comm.c:531)
==4632== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==4632==
==4632== Process terminating with default action of signal 11 (SIGSEGV)
==4632== Access not within mapped region at address 0x0
==4632== at 0x41E12AE: strcasecmp (in /lib/libc-2.8.90.so)
==4632== by 0x81B6814: bsearch_skill_exact(char const*, int, int) (magic.c:291)
==4632== by 0x81B70A5: skill_lookup(char const*) (magic.c:161)
==4632== by 0x82354E8: spec_mage_defend (special.c:1227)
==4632== by 0x8245F32: mobile_update() (update.c:850)
==4632== by 0x8248D90: update_handler() (update.c:2323)
==4632== by 0x814648A: game_loop() (comm.c:873)
==4632== by 0x8148353: main (comm.c:531)
==4632==
==4632== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 39 from 2)
==4632== malloc/free: in use at exit: 2,600,544 bytes in 33,331 blocks.
==4632== malloc/free: 34,820 allocs, 1,489 frees, 2,807,117 bytes allocated.
==4632== For counts of detected errors, rerun with: -v
==4632== searching for pointers to 33,331 not-freed blocks.
==4632== checked 2,975,820 bytes.
==4632==
==4632== LEAK SUMMARY:
==4632== definitely lost: 1,428 bytes in 43 blocks.
==4632== possibly lost: 0 bytes in 0 blocks.
==4632== still reachable: 2,599,116 bytes in 33,288 blocks.
==4632== suppressed: 0 bytes in 0 blocks.
==4632== Rerun with –leak-check=full to see details of leaked memory.
Segmentation fault
switch(ch->Class) {
case CLASS_MAGE:
spec_mage(ch);
spec_mage_defend(ch);
break;
case CLASS_CLERIC:/*
if(ch->Alignment < ALIGNMENT_EVIL)
do_evil_priest_things();
else if(ch->Alignment > ALIGNMENT_GOOD)
do_good_priest_things();
else
do_neutral_priest_things();*/
spec_cleric(ch);
spec_cleric_defend(ch);
break;
default:
spec_warrior(ch);
break;
}
case 2:
if ( !IS_AFFECTED (ch, AFF_HASTE))
{
min_level = 17;
spell = "haste";
break;
}
else
break;
case 2:
if ( !IS_AFFECTED (ch, AFF_HASTE))
{
min_level = 17;
spell = "haste";
break;
}
else {
spell = NULL;
break;
}
bool spec_mage_defend( CHAR_DATA * ch )
{
char *spell;
int sn;
if( ch->position == POS_FIGHTING)
return FALSE;
spell = NULL;
for( ;; )
{
int min_level;
switch ( number_bits( 4 ) )
{
case 0:
min_level = 0;
spell = "armor";
break;
case 1:
min_level = 8;
spell = "kindred strength";
break;
case 2:
if ( !IS_AFFECTED (ch, AFF_HASTE))
{
min_level = 17;
spell = "haste";
break;
}
else
break;
default:
if ( !IS_AFFECTED (ch, AFF_SHOCKSHIELD)) {
min_level = 20;
spell = "shockshield";
break;
}
else
break;
}
if( ch->level >= min_level )
break;
}
if (spell == NULL)
return FALSE;
if( ( sn = skill_lookup( spell ) ) < 0 )
return FALSE;
do_cast(ch, spell);
return TRUE;
}
case 2:
if ( !IS_AFFECTED (ch, AFF_HASTE))
{
min_level = 17;
spell = "haste";
}
break;
When I run the game it crashes shortly after startup. When ran in gdb I get this:
I'm not sure exactly what's going on here. Can someone point me in a direction?
Line 382 is the end of the cleanup_memory function.
strcasecmp is mainly used in imc.c and in david haley's skill table additions in magic.c and tables.c. This version of smaugfuss has lua installed so there are a few instances of strcasecmp in lua_scripting.c
**EDIT**
Smaugfuss 1.9 runs cleanly.