Mercurial > octave
changeset 26426:3e43775ab21c stable
getopt-wrapper.c: Fix static analyzer detected issues (bug #55347).
* getopt-wrapper.c: Check result of malloc. If there is not enough memory even
to start Octave then abort.
author | Rik <rik@octave.org> |
---|---|
date | Fri, 04 Jan 2019 12:18:11 -0800 |
parents | 6bfed6e4e9e9 |
children | 93c7fc75b103 |
files | liboctave/wrappers/getopt-wrapper.c |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/wrappers/getopt-wrapper.c Fri Jan 04 09:32:18 2019 -0800 +++ b/liboctave/wrappers/getopt-wrapper.c Fri Jan 04 12:18:11 2019 -0800 @@ -50,6 +50,11 @@ retval = (struct option *) malloc ((n+1) * sizeof (struct option)); + // If we don't have enough memory even to start Octave + // then we might as well quit now. + if (! retval) + abort (); + p = opts; q = retval; while (p->name)