mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-07-24 10:25:42 -04:00
preproc: inc_fopen -- set sl->next early
It's safer to init it early and be sure we not miss anything after. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
parent
c515774a92
commit
6f38fe6cd5
@ -1655,11 +1655,11 @@ static FILE *inc_fopen(const char *file, StrList **dhead, StrList ***dtail,
|
|||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
sl = nasm_malloc(prefix_len+len+1+sizeof sl->next);
|
sl = nasm_malloc(prefix_len+len+1+sizeof sl->next);
|
||||||
|
sl->next = NULL;
|
||||||
memcpy(sl->str, prefix, prefix_len);
|
memcpy(sl->str, prefix, prefix_len);
|
||||||
memcpy(sl->str+prefix_len, file, len+1);
|
memcpy(sl->str+prefix_len, file, len+1);
|
||||||
fp = fopen(sl->str, "r");
|
fp = fopen(sl->str, "r");
|
||||||
if (fp && dhead && !in_list(*dhead, sl->str)) {
|
if (fp && dhead && !in_list(*dhead, sl->str)) {
|
||||||
sl->next = NULL;
|
|
||||||
**dtail = sl;
|
**dtail = sl;
|
||||||
*dtail = &sl->next;
|
*dtail = &sl->next;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user