X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fzfs_arc.c;h=41a89b16aef5348bb26a6d24a43fad50f316d5b7;hb=70ea9457f76d6cd953f2cbd64eeda0ff265f47db;hp=dd633d5f2287352969f1619f553c105eccd7eade;hpb=83bd4369fc36851bb9a92d0dd3a9d3bc6a408fdd;p=collectd.git diff --git a/src/zfs_arc.c b/src/zfs_arc.c index dd633d5f..41a89b16 100644 --- a/src/zfs_arc.c +++ b/src/zfs_arc.c @@ -186,7 +186,7 @@ static int za_read (void) return (-1); } - len = read_file_contents (ZOL_ARCSTATS_FILE, file_contents, sizeof(file_contents)); + len = read_file_contents (ZOL_ARCSTATS_FILE, file_contents, sizeof(file_contents) - 1); if (len > 1) { @@ -208,6 +208,11 @@ static int za_read (void) { llentry_t *e; llvalues = malloc(sizeof(long long int) * i); + if (llvalues == NULL) + { + ERROR ("zfs_arc plugin: `malloc' failed."); + return (-1); + } int j = 0; pnl = file_contents;