Reorder some code in bscheck() - dedup - deduplicating backup program
 (HTM) git clone git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Tags
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit ff783e2a9af6d97d55697d654d759ca48d6a28a1
 (DIR) parent 1dd953c0a3654c65c1bade8096a234e51caed46c
 (HTM) Author: sin <sin@2f30.org>
       Date:   Sat, 27 Apr 2019 18:30:41 +0100
       
       Reorder some code in bscheck()
       
       Diffstat:
         M bstorage.c                          |      15 +++++----------
       
       1 file changed, 5 insertions(+), 10 deletions(-)
       ---
 (DIR) diff --git a/bstorage.c b/bstorage.c
       @@ -630,14 +630,12 @@ bscheck(struct bctx *bctx, unsigned char *md)
                if (bd == NULL)
                        return -1;
        
       -        buf = malloc(bd->size);
       -        if (buf == NULL)
       +        if (lseek(sctx->fd, bd->offset, SEEK_SET) < 0)
                        return -1;
        
       -        if (lseek(sctx->fd, bd->offset, SEEK_SET) < 0) {
       -                free(buf);
       +        buf = malloc(bd->size);
       +        if (buf == NULL)
                        return -1;
       -        }
        
                if (xread(sctx->fd, buf, bd->size) != bd->size) {
                        free(buf);
       @@ -648,13 +646,10 @@ bscheck(struct bctx *bctx, unsigned char *md)
                        free(buf);
                        return -1;
                }
       +        free(buf);
        
       -        if (memcmp(key.md, md, MDSIZE) != 0) {
       -                free(buf);
       +        if (memcmp(key.md, md, MDSIZE) != 0)
                        return -1;
       -        }
       -
       -        free(buf);
                return 0;
        }