Re: [PATCH] path: use xmalloc in add_to_trie

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

 



On Tue, Oct 24, 2017 at 8:15 AM, Andrey Okoshkin <a.okoshkin@xxxxxxxxxxx> wrote:
> Add usage of xmalloc() instead of malloc() in add_to_trie() as xmalloc wraps
> and checks memory allocation result.
>
> Signed-off-by: Andrey Okoshkin <a.okoshkin@xxxxxxxxxxx>
> ---
> Hello,
> I'm not sure but it looks like there is a missing check of the malloc result.
> memcpy() may crash with SIGSEGV due to the memory allocation failure.
> make_trie_node() uses xmalloc() and xcalloc() - so I believe add_to_trie()
> also should use it.

Good catch! Thanks for spotting.

Trying to find similar occurrences via git grep "= malloc" did not
yield other places that need the same fix.

Thanks,
Stefan



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux