[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #60535] malloc bug in unistd-wrappers.c
From: |
John W. Eaton |
Subject: |
[Octave-bug-tracker] [bug #60535] malloc bug in unistd-wrappers.c |
Date: |
Thu, 6 May 2021 05:15:35 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 |
Follow-up Comment #2, bug #60535 (project octave):
Instead of
new_argv = malloc ((argc + 1) * sizeof (*new_argv));
I would write
new_argv = (char **) malloc ((argc + 1) * sizeof (char *));
(though I suppose we could do away with the cast on the value returned from
malloc since this is C code).
I would not change the other allocation because sizeof (char) is always 1 by
definition, though I can also see the argument for using sizeof the way you
did. I'm not sure what is best here, but I don't recall seeing that style
used before.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?60535>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #60535] malloc bug in unistd-wrappers.c, Gene Harvey, 2021/05/06
- [Octave-bug-tracker] [bug #60535] malloc bug in unistd-wrappers.c, Markus Mützel, 2021/05/06
- [Octave-bug-tracker] [bug #60535] malloc bug in unistd-wrappers.c,
John W. Eaton <=
- [Octave-bug-tracker] [bug #60535] malloc bug in unistd-wrappers.c, Markus Mützel, 2021/05/06
- [Octave-bug-tracker] [bug #60535] malloc bug in unistd-wrappers.c, Markus Mützel, 2021/05/06
- [Octave-bug-tracker] [bug #60535] malloc bug in unistd-wrappers.c, Markus Mützel, 2021/05/06
- [Octave-bug-tracker] [bug #60535] malloc bug in unistd-wrappers.c, Markus Mützel, 2021/05/07
- [Octave-bug-tracker] [bug #60535] malloc bug in unistd-wrappers.c, Markus Mützel, 2021/05/09
- [Octave-bug-tracker] [bug #60535] malloc bug in unistd-wrappers.c, Markus Mützel, 2021/05/14
- [Octave-bug-tracker] [bug #60535] malloc bug in unistd-wrappers.c, John W. Eaton, 2021/05/14
- [Octave-bug-tracker] [bug #60535] malloc bug in unistd-wrappers.c, John W. Eaton, 2021/05/14
- [Octave-bug-tracker] [bug #60535] malloc bug in unistd-wrappers.c, Markus Mützel, 2021/05/15
- [Octave-bug-tracker] [bug #60535] malloc bug in unistd-wrappers.c, Markus Mützel, 2021/05/17