diff options
author | Henrik Nord <[email protected]> | 2012-02-14 10:42:55 +0100 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2012-02-14 10:43:55 +0100 |
commit | 371fdc581bd2c3678dd0cbca92cfa7c0d069338b (patch) | |
tree | 1556867fecbdef580b6e8b00e6372b486a78db56 | |
parent | e89d1abc81d1dbbc5613668c74f0cd50c887bc33 (diff) | |
parent | a95ebdd1232122d168931f55c9863960316576e2 (diff) | |
download | otp-371fdc581bd2c3678dd0cbca92cfa7c0d069338b.tar.gz otp-371fdc581bd2c3678dd0cbca92cfa7c0d069338b.tar.bz2 otp-371fdc581bd2c3678dd0cbca92cfa7c0d069338b.zip |
Merge branch 'av/maint-memsup' into maint
* av/maint-memsup:
Fix segmentation fault in memsup
OTP-9913
-rw-r--r-- | lib/os_mon/c_src/memsup.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/os_mon/c_src/memsup.c b/lib/os_mon/c_src/memsup.c index 241e7718db..b6e417eaa0 100644 --- a/lib/os_mon/c_src/memsup.c +++ b/lib/os_mon/c_src/memsup.c @@ -327,27 +327,27 @@ get_mem_procfs(memory_ext *me){ /* Total and free is NEEDED! */ bp = strstr(buffer, "MemTotal:"); - if (sscanf(bp, "MemTotal: %lu kB\n", &(me->total))) me->flag |= F_MEM_TOTAL; + if (bp != NULL && sscanf(bp, "MemTotal: %lu kB\n", &(me->total))) me->flag |= F_MEM_TOTAL; bp = strstr(buffer, "MemFree:"); - if (sscanf(bp, "MemFree: %lu kB\n", &(me->free))) me->flag |= F_MEM_FREE; + if (bp != NULL && sscanf(bp, "MemFree: %lu kB\n", &(me->free))) me->flag |= F_MEM_FREE; /* Extensions */ bp = strstr(buffer, "Buffers:"); - if (sscanf(bp, "Buffers: %lu kB\n", &(me->buffered))) me->flag |= F_MEM_BUFFERS; + if (bp != NULL && sscanf(bp, "Buffers: %lu kB\n", &(me->buffered))) me->flag |= F_MEM_BUFFERS; bp = strstr(buffer, "Cached:"); - if (sscanf(bp, "Cached: %lu kB\n", &(me->cached))) me->flag |= F_MEM_CACHED; + if (bp != NULL && sscanf(bp, "Cached: %lu kB\n", &(me->cached))) me->flag |= F_MEM_CACHED; /* Swap */ bp = strstr(buffer, "SwapTotal:"); - if (sscanf(bp, "SwapTotal: %lu kB\n", &(me->total_swap))) me->flag |= F_SWAP_TOTAL; + if (bp != NULL && sscanf(bp, "SwapTotal: %lu kB\n", &(me->total_swap))) me->flag |= F_SWAP_TOTAL; bp = strstr(buffer, "SwapFree:"); - if (sscanf(bp, "SwapFree: %lu kB\n", &(me->free_swap))) me->flag |= F_SWAP_FREE; + if (bp != NULL && sscanf(bp, "SwapFree: %lu kB\n", &(me->free_swap))) me->flag |= F_SWAP_FREE; me->pagesize = 1024; /* procfs defines its size in kB */ |