HomeFreeBSD

Fix several memory leaks, and crashes, in iconvlist(3).

Description

Fix several memory leaks, and crashes, in iconvlist(3).

  • Both curitem and curitem (via the names list) was always leaked.
  • malloc(3) failures lead to some leaks.
  • bsd_iconv_get_list() failure lead to a crash since its error was not handles and bsd_iconv_free_list() is not NULL-safe.

I have slightly refactored this to avoid extra malloc and free logic in cases
of malloc(3) failing.

There are still bad assumptions here that I did not deal with. One of which is
that the data will always have a '/' so the strchr(3) will not return NULL.

Coverity CID: 1130055 1130054 1130053

Details

Provenance
bdreweryAuthored on
Parents
rS290167: Fix LEAVE_HYP macro: spsr is not guaranteed to contain valid value at this
Branches
Unknown
Tags
Unknown