Re: [RFC 2/7] kernel-shark: Add new dataloading method to be used by the NumPu interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 27, 2019 at 6:04 PM Yordan Karadzhov <ykaradzhov@xxxxxxxxxx> wrote:
<snip>
> +       if (offset_array)
> +               free(offset_array);

This should be
    free(*offset_array);
and ditto for the rest.

Also in the very unlikely event of malloc() failing, if the caller
didn't initialize the arguments before calling, this will be calling
free() with garbage. If we're paranoid for this case, we can either
1) have NULL initialized local variables where we malloc() and on
failure free(), or on success assign to the output arguments
2) have a separate label for each malloc() failure case and jump to
the correct label when malloc() fails

-- Slavi




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux