mirror of
https://github.com/kevinbentley/Descent3.git
synced 2025-01-22 11:28:56 +00:00
[DMFC] Fixed missing va_end calls in case of function early outs
This commit is contained in:
parent
68334c54f4
commit
582869bc50
@ -214,8 +214,10 @@ MenuItem::MenuItem(const char *title, char type, uint8_t flags, void (*fp)(int),
|
||||
m_iState = va_arg(marker, int);
|
||||
if ((SubMenuCount > 0) && (SubMenuCount < MAX_STATE_SUBMENUS)) {
|
||||
SubMenus = (IMenuItem **)malloc(sizeof(IMenuItem *) * SubMenuCount);
|
||||
if (!SubMenus)
|
||||
if (!SubMenus) {
|
||||
va_end(marker);
|
||||
return;
|
||||
}
|
||||
char *string;
|
||||
for (int i = 0; i < SubMenuCount; i++) {
|
||||
string = va_arg(marker, char *);
|
||||
@ -873,8 +875,10 @@ bool MenuItem::SetStateItemList(int count, ...) {
|
||||
|
||||
if ((SubMenuCount > 0) && (SubMenuCount < MAX_STATE_SUBMENUS)) {
|
||||
SubMenus = (IMenuItem **)malloc(sizeof(IMenuItem *) * SubMenuCount);
|
||||
if (!SubMenus)
|
||||
if (!SubMenus) {
|
||||
va_end(marker);
|
||||
return false;
|
||||
}
|
||||
char *string;
|
||||
for (int i = 0; i < SubMenuCount; i++) {
|
||||
string = va_arg(marker, char *);
|
||||
|
Loading…
Reference in New Issue
Block a user