Ticket #9871: 0005-Chunk-Chunk-Fix-Null-pointer-argument-in-call-to-mem.2.patch

File 0005-Chunk-Chunk-Fix-Null-pointer-argument-in-call-to-mem.2.patch, 1.0 KB (added by mt, 7 years ago)

New patch

  • src/add-ons/kernel/file_systems/btrfs/Chunk.cpp

    From 45d497c1d34a622d40d038082bd3660e067a76bc Mon Sep 17 00:00:00 2001
    From: Murai Takashi <tmurai01@gmail.com>
    Date: Sun, 14 Jul 2013 17:34:46 +0900
    Subject: [PATCH] Chunk::Chunk(), Fix Null pointer argument in call to memory copy function
    
    ---
     src/add-ons/kernel/file_systems/btrfs/Chunk.cpp |    6 +++++-
     1 file changed, 5 insertions(+), 1 deletion(-)
    
    diff --git a/src/add-ons/kernel/file_systems/btrfs/Chunk.cpp b/src/add-ons/kernel/file_systems/btrfs/Chunk.cpp
    index 95d82a4..aeb1bb6 100644
    a b Chunk::Chunk(struct btrfs_chunk* chunk, fsblock_t offset)  
    3030    fChunkOffset = offset;
    3131    fChunk = (struct btrfs_chunk*)malloc(sizeof(struct btrfs_chunk)
    3232        + chunk->StripeCount() * sizeof(struct btrfs_stripe));
    33     if (fChunk == NULL)
     33
     34    if (fChunk == NULL) {
    3435        fInitStatus = B_NO_MEMORY;
     36        return;
     37    }
     38
    3539    memcpy(fChunk, chunk, sizeof(struct btrfs_chunk)
    3640        + chunk->StripeCount() * sizeof(struct btrfs_stripe));
    3741