Skip to content

Fixed typo in block_alloc#93

Open
zedseven wants to merge 1 commit intovasi:masterfrom
zedseven:master
Open

Fixed typo in block_alloc#93
zedseven wants to merge 1 commit intovasi:masterfrom
zedseven:master

Conversation

@zedseven
Copy link

In write.c Line 263, parts is compared against BLOCK_IN despite dealing with output, and the corresponding block_dealloc checks BLOCK_OUT instead. Is this a typo?

static void block_alloc(io_block_t *ib, block_parts parts) {
    if ((parts & BLOCK_IN) && !ib->input)
        ib->input = malloc(gBlockInSize);
    if ((parts & BLOCK_IN) && !ib->output) // <-- I believe this line should be BLOCK_OUT
        ib->output = malloc(gBlockOutSize);
    if (!ib->input || !ib->output)
        die("Can't allocate blocks");
}

The corresponding block_dealloc:

static void block_dealloc(io_block_t *ib, block_parts parts) {
    if (parts & BLOCK_IN) {
        free(ib->input);
        ib->input = NULL;
    }
    if (parts & BLOCK_OUT) { // <-- Uses BLOCK_OUT
        free(ib->output);
        ib->output = NULL;
    }
}

@vasi
Copy link
Owner

vasi commented Mar 22, 2021

That looks correct! Not sure what's wrong with CI though.

@vasi
Copy link
Owner

vasi commented Mar 28, 2021

Yeah, the CI failure is real, I can reproduce with make check locally. Can you?

@satmandu
Copy link

satmandu commented May 5, 2021

Is this a bug users should be worried about?

rescbr added a commit to rescbr/pixz that referenced this pull request Feb 14, 2026
rescbr added a commit to rescbr/pixz that referenced this pull request Feb 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants