pawn Код:
cache_get_row(0, 37, temp);
Is that correct? If it is then your query isn't optimized at all. Only select the field you need. Besides that, it looks like you're fetching a salt from the database and then using that same salt to query the database again. You should use MySQL's CONCAT() function to save up on unnecessary queries.
I think the crash might actually be caused by fetching a new result while the previous result hasn't been freed yet.