Commit efefccd
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 a329721 commit efefccd
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 | |
|---|---|---|---|
| |||
8524 | 8524 | | |
8525 | 8525 | | |
8526 | 8526 | | |
8527 | | - | |
| 8527 | + | |
| 8528 | + | |
| 8529 | + | |
| 8530 | + | |
| 8531 | + | |
| 8532 | + | |
| 8533 | + | |
| 8534 | + | |
| 8535 | + | |
| 8536 | + | |
8528 | 8537 | | |
8529 | 8538 | | |
8530 | 8539 | | |
| |||
8617 | 8626 | | |
8618 | 8627 | | |
8619 | 8628 | | |
8620 | | - | |
| 8629 | + | |
8621 | 8630 | | |
8622 | 8631 | | |
8623 | 8632 | | |
8624 | 8633 | | |
8625 | | - | |
8626 | | - | |
8627 | | - | |
8628 | | - | |
| 8634 | + | |
| 8635 | + | |
8629 | 8636 | | |
8630 | 8637 | | |
8631 | 8638 | | |
| |||
30762 | 30769 | | |
30763 | 30770 | | |
30764 | 30771 | | |
| 30772 | + | |
| 30773 | + | |
30765 | 30774 | | |
30766 | 30775 | | |
30767 | 30776 | | |
| |||
| 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