mirror of
https://github.com/kdave/btrfs-progs
synced 2025-04-25 20:47:58 +00:00
btrfs-progs: handle memory allocation error in cmd_device_stats
Resolves-coverity-id: 1359012 Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
0121270a79
commit
5fcc6e93f0
@ -450,6 +450,10 @@ static int cmd_device_stats(int argc, char **argv)
|
|||||||
/* No path when device is missing. */
|
/* No path when device is missing. */
|
||||||
if (!canonical_path) {
|
if (!canonical_path) {
|
||||||
canonical_path = malloc(32);
|
canonical_path = malloc(32);
|
||||||
|
if (!canonical_path) {
|
||||||
|
error("not enough memory for path buffer");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
snprintf(canonical_path, 32,
|
snprintf(canonical_path, 32,
|
||||||
"devid:%llu", args.devid);
|
"devid:%llu", args.devid);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user