mirror of
https://github.com/holub/mame
synced 2025-04-26 10:13:37 +03:00
inpttype: fix lifetime error (nwn)
This commit is contained in:
parent
87ab11f6d2
commit
6b0e05e474
@ -2991,6 +2991,7 @@ void diplocation_list_alloc(input_field_config &field, const char *location, ast
|
|||||||
field.diploclist().reset();
|
field.diploclist().reset();
|
||||||
|
|
||||||
/* parse the string */
|
/* parse the string */
|
||||||
|
astring name; // Don't move this variable inside the loop, lastname's lifetime depends on it being outside
|
||||||
const char *lastname = NULL;
|
const char *lastname = NULL;
|
||||||
const char *curentry = location;
|
const char *curentry = location;
|
||||||
int entries = 0;
|
int entries = 0;
|
||||||
@ -3010,7 +3011,6 @@ void diplocation_list_alloc(input_field_config &field, const char *location, ast
|
|||||||
const char *colon = strchr(tempstr, ':');
|
const char *colon = strchr(tempstr, ':');
|
||||||
|
|
||||||
/* allocate and copy the name if it is present */
|
/* allocate and copy the name if it is present */
|
||||||
astring name;
|
|
||||||
if (colon != NULL)
|
if (colon != NULL)
|
||||||
{
|
{
|
||||||
lastname = name.cpy(number, colon - number);
|
lastname = name.cpy(number, colon - number);
|
||||||
|
Loading…
Reference in New Issue
Block a user