From 5fcc6e93f05182c598c389ce2c4b9c68a385521f Mon Sep 17 00:00:00 2001 From: David Sterba Date: Mon, 2 May 2016 15:03:24 +0200 Subject: btrfs-progs: handle memory allocation error in cmd_device_stats Resolves-coverity-id: 1359012 Signed-off-by: David Sterba --- cmds-device.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cmds-device.c') diff --git a/cmds-device.c b/cmds-device.c index 5c0040c4..1c886ad5 100644 --- a/cmds-device.c +++ b/cmds-device.c @@ -450,6 +450,10 @@ static int cmd_device_stats(int argc, char **argv) /* No path when device is missing. */ if (!canonical_path) { canonical_path = malloc(32); + if (!canonical_path) { + error("not enough memory for path buffer"); + goto out; + } snprintf(canonical_path, 32, "devid:%llu", args.devid); } -- cgit v1.2.3