The change in internal energy of the gas is a function of the compression work, heat transfer, and leakage:

$$\fracdmdt = \dotm \textsuction - \dotm \textdischarge + \sum \dotm_\textleakage$$