An overheating compressor is cause for concern, not only because it has the potential to cause a fire, but also because it could eventually fail and leave you with a refrigerator full of tainted food. If you suspect the compressor might be getting too hot, it's time take a action quickly. Since tracing the problem and fixing it is not an exact science, you might consider finding alternate cool storage until you can figure out what is causing the problem.
In simple terms, a compressor that runs too hot is being forced to work too hard or for too long a time, which generally means there is a problem somewhere in the cooling system. Maybe the thermostat on the fridge is set too low, or there is not enough refrigerant; these are two common reasons a compressor can run hot. Even if the excessive heat never causes a fire, prolonged overheating can lead to a shorter service life for the appliance through premature mechanical failure.
Condenser coils are intended to dissipate heat extracted from inside the refrigerator. Over time, these coils can become covered with dust and other particles that keep the heat from dissipating. The heat then can build up in various other parts of the cooling system, including the compressor, causing a rise in temperature. You can help avoid this problem by dusting the coils periodically.
Your refrigerator compressor has a cooling fan built into the unit to get rid of the heat generated as refrigerant is transformed from liquid to gas and back again. It takes a lot of mechanical energy to do this. Failure of the cooling fan could be a direct cause of an overheated compressor.
While a compressor can run in an overheated condition for a while, it will fail eventually -- probably before the natural life expectancy of the appliance. Since refrigerator's aren't cheap, it makes sense to take action sooner rather than later if you suspect such a problem exists. If you don't have the time or inclination to troubleshoot the problem yourself, you can call a professional repairman.