* [PATCH] btrfs-progs: handle memory allocation error in cmd_device_stats
@ 2016-05-02 13:12 David Sterba
0 siblings, 0 replies; only message in thread
From: David Sterba @ 2016-05-02 13:12 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Resolves-coverity-id: 1359012
Signed-off-by: David Sterba <dsterba@suse.com>
---
cmds-device.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/cmds-device.c b/cmds-device.c
index 5c0040c4f2ab..1c886ad58939 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);
}
--
2.7.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-05-02 13:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-02 13:12 [PATCH] btrfs-progs: handle memory allocation error in cmd_device_stats David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).