fish: handle some out-of-memory conditions
authorJim Meyering <meyering@redhat.com>
Wed, 1 Jul 2009 14:09:33 +0000 (16:09 +0200)
committerJim Meyering <meyering@redhat.com>
Wed, 1 Jul 2009 16:42:19 +0000 (18:42 +0200)
commitf20854ec61eef1aea313920f0cf193a78c1a9219
tree41f3dd9bc1ee22ad88d6e576e19ec0c33c74157d
parent99e28249d52ca5495b636e14ae3e4387ee62c8fe
fish: handle some out-of-memory conditions

* fish/destpaths.c (xalloc_oversized): Define.
(complete_dest_paths_generator): Use size_t as type for a few
variables, rather than int.
Don't deref NULL or undef on failed heap alloc.
Don't leak on failed realloc.
Detect theoretical overflow when count_strings returns a very
large number of strings.
Handle asprintf failure.
(APPEND_STRS_AND_FREE): Rewrite as do {...}while(0), so that each use
can/must be followed by a semicolon.  Better for auto-formatters.
fish/destpaths.c