Skip to content

Commit 8be57bc

Browse files
swt2cAlvaro-Kothe
andauthored
Backport PR #62217 on branch 2.3.x (BUG: fix memory leak in JSON datetime serialization) (#62253)
Co-authored-by: Álvaro Kothe <[email protected]>
1 parent 4579b88 commit 8be57bc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pandas/_libs/src/vendored/ujson/python/objToJSON.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,8 @@ static char *PyDateTimeToIsoCallback(JSOBJ obj, JSONTypeContext *tc,
346346
}
347347

348348
NPY_DATETIMEUNIT base = ((PyObjectEncoder *)tc->encoder)->datetimeUnit;
349-
return PyDateTimeToIso(obj, base, len);
349+
GET_TC(tc)->cStr = PyDateTimeToIso(obj, base, len);
350+
return GET_TC(tc)->cStr;
350351
}
351352

352353
static char *PyTimeToJSON(JSOBJ _obj, JSONTypeContext *tc, size_t *outLen) {

0 commit comments

Comments
 (0)