AP_Menu: zero buffer contents on allocation

This commit is contained in:
Andrew Tridgell 2013-11-06 09:12:00 +11:00
parent 470e5f570d
commit 46724db144
1 changed files with 2 additions and 0 deletions

View File

@ -202,8 +202,10 @@ Menu::_allocate_buffers(void)
/* only allocate if the buffers are NULL */
if (_inbuf == NULL) {
_inbuf = new char[_commandline_max];
memset(_inbuf, 0, _commandline_max);
}
if (_argv == NULL) {
_argv = new arg[_args_max+1];
memset(_argv, 0, (_args_max+1) * sizeof(_argv[0]));
}
}