Commit d5f2d34
committed
Fix crash in nk_buffer_realloc and forbid the use of realloc
In short: the default implementation of nk_allocator (aka nk_malloc)
is fundamentally broken, and should have used realloc instead of malloc.
This led to the strange workaround in nk_buffer_realloc that would
crash whenever you use custom allocator with correct realloc assumption.
We cannot change nk_malloc at this point, as people could have
implemented their own allocators based on it, but we can ensure that
Nuklear itself will never try to reallocate memory.
Fixes: #7681 parent 25f33c8 commit d5f2d34
4 files changed
Lines changed: 30 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | 115 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | 116 | | |
126 | 117 | | |
127 | 118 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8519 | 8519 | | |
8520 | 8520 | | |
8521 | 8521 | | |
8522 | | - | |
| 8522 | + | |
| 8523 | + | |
| 8524 | + | |
| 8525 | + | |
| 8526 | + | |
| 8527 | + | |
| 8528 | + | |
| 8529 | + | |
| 8530 | + | |
| 8531 | + | |
8523 | 8532 | | |
8524 | 8533 | | |
8525 | 8534 | | |
| |||
8612 | 8621 | | |
8613 | 8622 | | |
8614 | 8623 | | |
8615 | | - | |
| 8624 | + | |
8616 | 8625 | | |
8617 | 8626 | | |
8618 | 8627 | | |
8619 | 8628 | | |
8620 | | - | |
8621 | | - | |
8622 | | - | |
8623 | | - | |
| 8629 | + | |
| 8630 | + | |
8624 | 8631 | | |
8625 | 8632 | | |
8626 | 8633 | | |
| |||
30757 | 30764 | | |
30758 | 30765 | | |
30759 | 30766 | | |
| 30767 | + | |
| 30768 | + | |
30760 | 30769 | | |
30761 | 30770 | | |
30762 | 30771 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
15 | 24 | | |
16 | 25 | | |
17 | 26 | | |
| |||
104 | 113 | | |
105 | 114 | | |
106 | 115 | | |
107 | | - | |
| 116 | + | |
108 | 117 | | |
109 | 118 | | |
110 | 119 | | |
111 | 120 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
| 121 | + | |
| 122 | + | |
116 | 123 | | |
117 | 124 | | |
118 | 125 | | |
| |||
0 commit comments