> compile NEMU
ysyx_22040000 李心杨 Linux calcite 6.1.75 #1-NixOS SMP PREEMPT_DYNAMIC Thu Jan 25 23:27:52 UTC 2024 x86_64 GNU/Linux 18:59:10 up 1 day 4:35, 2 users, load average: 0.39, 0.70, 0.73
This commit is contained in:
parent
d784f80261
commit
074ec5b4a1
1 changed files with 3 additions and 2 deletions
|
@ -76,13 +76,14 @@ int wp_add(char * expr) {
|
|||
tail->next = wp;
|
||||
tail = wp;
|
||||
}
|
||||
int len = strlen(expr);
|
||||
int len = strlen(expr) + 1;
|
||||
wp->expr = malloc(len * sizeof(char));
|
||||
if (wp->expr == NULL) {
|
||||
Error("Failed to allocate memory for expression");
|
||||
return 1;
|
||||
}
|
||||
strncpy(wp->expr, expr, len - 1);
|
||||
strncpy(wp->expr, expr, len);
|
||||
wp->expr[len - 1] = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue