Nearly right, but you're never ending the for loop until mob == NULL... you need to either break when you find the mob, or save it in another variable.
for(mob = char_list; mob != NULL; mob = mob->next)
if(IS_NPC(mob) && mob->pIndexData->vnum ==
ch->pcdata->questmob)
break;
if (mob == NULL)
end_quest(ch, 5);
else
...

