]> Savannah Git Hosting - gnulib.git/commit
getopt: don't crash on memory exhaustion
authorPádraig Brady <P@draigBrady.com>
Wed, 18 Feb 2015 02:23:35 +0000 (02:23 +0000)
committerPádraig Brady <P@draigBrady.com>
Wed, 18 Feb 2015 18:34:52 +0000 (18:34 +0000)
commit6fa31e52cb3547f3c89b3a4c6547d1d92292ac15
tree87d9b4ebd8de11794f6efc4bc604b6c13e3ac64c
parent4f2e9100023b9ca5c4844133a53816c079214eab
getopt: don't crash on memory exhaustion

* lib/getopt.c (_getopt_internal_r): Use degraded diagnostics on
memory exhaustion.  In the _LIBC case we use alloca() as is
already done in glibc, so we don't need to consider the separate
error path in that awkward case.  Also fix a memory leak when
ambiguous options are present.
Reported by Tobias Stoeckmann
ChangeLog
lib/getopt.c