File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
graalpython/com.oracle.graal.python.cext/src Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -190,14 +190,18 @@ void* PyMem_RawCalloc(size_t nelem, size_t elsize) {
190
190
}
191
191
192
192
void * PyMem_RawRealloc (void * ptr , size_t new_size ) {
193
- mem_head_t * old = ptr != NULL ? AS_MEM_HEAD (ptr ) : NULL ;
194
-
195
- // account for the difference in size
196
- if (old -> size >= new_size ) {
197
- PyTruffle_FreeMemory (old -> size - new_size );
198
- } else {
199
- if (PyTruffle_AllocMemory (new_size - old -> size )) {
200
- return NULL ;
193
+ mem_head_t * old ;
194
+
195
+ if (ptr != NULL ) {
196
+ ptr = AS_MEM_HEAD (ptr );
197
+
198
+ // account for the difference in size
199
+ if (old -> size >= new_size ) {
200
+ PyTruffle_FreeMemory (old -> size - new_size );
201
+ } else {
202
+ if (PyTruffle_AllocMemory (new_size - old -> size )) {
203
+ return NULL ;
204
+ }
201
205
}
202
206
}
203
207
You can’t perform that action at this time.
0 commit comments