Skip to content

Commit

Permalink
AER-5940 - don't divide by zero if physical memory reported is zero.
Browse files Browse the repository at this point in the history
  • Loading branch information
gooding470 committed Oct 1, 2018
1 parent 23aaca4 commit 500335a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cf/src/meminfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ cf_meminfo(uint64_t *physmem, uint64_t *freemem, int *freepct, bool *swapping)
if (freemem) *freemem = availableMem * 1024L;

// just easier to do this kind of thing in one place
if (freepct) *freepct = (100L * availableMem) / physMem;
if (freepct) *freepct = physMem == 0 ? 0 : (100L * availableMem) / physMem;

if (swapping) {
*swapping = false;
Expand Down

0 comments on commit 500335a

Please sign in to comment.