Skip to content

Commit 90818ba

Browse files
Alvaro-Kotheswt2c
authored andcommitted
BUG: fix memory leak in JSON datetime serialization (pandas-dev#62217)
1 parent c8b9658 commit 90818ba

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)