Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed typo in block_alloc #93

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fixed typo in block_alloc #93

wants to merge 1 commit into from

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?

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