> 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:57:24 up 1 day 4:33, 2 users, load average: 0.66, 0.87, 0.79
This commit is contained in:
parent
d3eaab6a5f
commit
10f368edbb
1 changed files with 7 additions and 1 deletions
|
@ -76,7 +76,13 @@ int wp_add(char * expr) {
|
|||
tail->next = wp;
|
||||
tail = wp;
|
||||
}
|
||||
wp->expr = expr;
|
||||
int len = strlen(expr);
|
||||
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);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue