aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorGravatar Andreas Ericsson <ae@op5.se> 2012-11-02 14:51:09 +0100
committerGravatar Thomas Guyot-Sionnest <dermoth@aei.ca> 2012-11-02 22:25:37 -0400
commit364ce21b1048d1125b8d3fd6744661ab581d08c7 (patch)
tree7450e9bd2d1ee3b0ae4c90e496e9fa28985b3763 /tools
parentbd782990566eec91b8312cfc2765a7e2bd9e67da (diff)
downloadmonitoring-plugins-364ce21b1048d1125b8d3fd6744661ab581d08c7.tar.gz
lib/utils_base.c: Stop dumping core on bad args to check_snmp
Since the state patch introduction, we've been freeing uninitialized memory in lib/utils_base.c::np_cleanup(), which caused coredumps with check_snmp when illegal threshold ranges (for example) were passed, or when we called 'die' without having read any state. This patch fixes it by replacing the malloc() calls in there (all of them, since using malloc() is almost always an error) with calloc(). malloc() either doesn't initialize the memory at all, or taints it with a special marker so it can tell us when we're free()'ing memory that hasn't been initialized. calloc() explicitly initializes the allocated memory to nul bytes, which is a zero-cost operation when we get the memory from the kernel (which alread does that) and almost always desirable everywhere else. Signed-off-by: Andreas Ericsson <ae@op5.se>
Diffstat (limited to 'tools')
0 files changed, 0 insertions, 0 deletions