The instability of nonhomentropic axisymmetric flows of ideal fluid with respect to two-dimensional infinitesimal perturbations with the nonconservation of angular momentum is investigated by numerically integrating the differential equations of hydrodynamics. This problem is important in studying the dynamics of astrophysical flows as shear fluid flows around a gravitating center. A complex influence of a nonzero entropy gradient on the instability of sonic and surface gravity modes has been found. In particular, both an increase and a decrease in entropy against the effective gravity g eff causes the growth of surface gravity modes that are stable at the same parameters for a homentropic flow. At the same time, the growth rate of the sonic instability branches either monotonically increases with increasing rate of decrease in entropy against g eff or becomes zero at both negative and positive entropy gradients in the unperturbed flow. Calculations also show that growing internal gravity modes appear in the problem with free boundaries under consideration only if the flow is no longer stable with respect to axisymmetric perturbations. In addition, we show that it is improper to specify the entropy distribution in the main flow by a polytropic law with a polytropic index different from the adiabatic value, since the perturbation field does not satisfy the boundary condition at a free boundary in this case.