Skip to content

Commit 2082edb

Browse files
committed
Add a comment
1 parent b0fed70 commit 2082edb

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

Objects/obmalloc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ _PyObject_MiRealloc(void *ctx, void *ptr, size_t nbytes)
363363
_mi_memcpy((char*)newp + offset, (char*)ptr + offset, copy_size - offset);
364364
}
365365
else {
366+
// memcpy(dst, NULL, 0) is undefined behavior. Guard against it.
366367
if mi_likely(ptr) {
367368
_mi_memcpy(newp, ptr, copy_size);
368369
}

0 commit comments

Comments
 (0)