aboutsummaryrefslogtreecommitdiffstats
path: root/btrfs-image.c
diff options
context:
space:
mode:
authorSilvio Fricke <silvio.fricke@gmail.com>2015-09-29 19:10:36 +0200
committerDavid Sterba <dsterba@suse.com>2015-10-21 14:29:26 +0200
commitc47a831cd653fa4ef4979ae7007e60037eddcb37 (patch)
tree69d07646892cda8a71072e8b7920a6afac6ccaec /btrfs-image.c
parent9c89f637a3d754ac401b7b6dabe5c7b8c336f848 (diff)
downloadbtrfs-progs-c47a831cd653fa4ef4979ae7007e60037eddcb37.tar.gz
btrfs-progs-c47a831cd653fa4ef4979ae7007e60037eddcb37.tar.xz
btrfs-progs-c47a831cd653fa4ef4979ae7007e60037eddcb37.zip
btrfs-progs: use calloc instead of malloc+memset
This patch is generated from a coccinelle semantic patch: identifier t; expression e; statement s; @@ -t = malloc(e); +t = calloc(1, e); ( if (!t) s | if (t == NULL) s | ) -memset(t, 0, e); Signed-off-by: Silvio Fricke <silvio.fricke@gmail.com> [squashed patches into one] Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'btrfs-image.c')
-rw-r--r--btrfs-image.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/btrfs-image.c b/btrfs-image.c
index 82eed05..20396ef 100644
--- a/btrfs-image.c
+++ b/btrfs-image.c
@@ -1505,10 +1505,9 @@ static struct extent_buffer *alloc_dummy_eb(u64 bytenr, u32 size)
{
struct extent_buffer *eb;
- eb = malloc(sizeof(struct extent_buffer) + size);
+ eb = calloc(1, sizeof(struct extent_buffer) + size);
if (!eb)
return NULL;
- memset(eb, 0, sizeof(struct extent_buffer) + size);
eb->start = bytenr;
eb->len = size;