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 <[email protected]>
---
 btrfs-image.c | 3 +--
 1 file changed, 1 insertion(+), 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;
-- 
2.5.3

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to