Thread

  1. Trivial Fix: use palloc_array/repalloc_array for BufFile file arrays

    Chao Li <li.evan.chao@gmail.com> — 2025-12-25T03:12:07Z

    Hi Hackers,
    
    I noticed this error while working on [1].
    
    In BufFile, the fields is claimed as an array:
    ```
    struct BufFile
    {
        File *files; /* palloc'd array with numFiles entries */
    ```
    
    However, it’s allocated by palloc_object():
    ```
    file->files = palloc_object(File);
    ```
    
    And reallocated by repalloc():
    ```
        file->files = (File *) repalloc(file->files,
            (file->numFiles + 1) * sizeof(File));
    ```
    
    This trivial patch just changes to use palloc_array/repalloc_array, which
    makes the intent clearer.
    
    Best regards,
    --
    Chao Li (Evan)
    HighGo Software Co., Ltd.
    https://www.highgo.com/