If you rinse the pants with water and do not wash them immediately after, make sure to leave them to dry in an airy place. Foul smelling bugs hates oxygen.  White vinegar is great as a deodorizer. You can either soak the pants in diluted vinegar (1 part vinegar and 3 parts water) or throw some vinegar in the machine before the last rinse  If you have stubborn bloodstains in your pants, it is great to wash them in enzyme containing detergent. The enzyme eats up the blood stain and removes bad odour.