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

Fix #4227 (double free in examples/train-text-from-scratch) #4351

Merged
merged 1 commit into from
Dec 7, 2023
Merged

Fix #4227 (double free in examples/train-text-from-scratch) #4351

merged 1 commit into from
Dec 7, 2023

Commits on Dec 6, 2023

  1. Fix #4227 (double free in examples/train-text-from-scratch/train-text…

    …-from-scratch.cpp)
    
    On commit b1108 (44c117f) xaedes added
    
        ggml_allocr * alloc = NULL;
    
        ... (many lines in between)
    
        if (alloc) {
            ggml_allocr_free(alloc);
        }
    
    Which is correct, but it's easy to lose context after many lines in between.
    
    On commit b1287 (0e76a899) xaedes made a big change. From here on, alloc is freed eagerly.
    
        alloc = ggml_allocr_new(...)
        ... (short lines of code)
        ggml_allocr_free(alloc)
    
    This happens a few times, but alloc is never set to NULL, and many lines below,
    we still have
    
        if (alloc) {
            ggml_allocr_free(alloc);
        }
    
    which causes a double-free.
    casavaca committed Dec 6, 2023
    Configuration menu
    Copy the full SHA
    27038a2 View commit details
    Browse the repository at this point in the history