Skip to content

Commit 87a7783

Browse files
committed
BUG: Fix memory leak in to_json for datetime64 objects
1 parent 3e1d6d5 commit 87a7783

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
@@ -347,7 +347,8 @@ static const char *PyDateTimeToIsoCallback(JSOBJ obj, JSONTypeContext *tc,
347347
}
348348

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

353354
static const char *PyTimeToJSON(JSOBJ _obj, JSONTypeContext *tc,

0 commit comments

Comments
 (0)