Merge pull request #861 from bhaible/handle-another-oom-condition

Handle yet another out-of-memory condition.
This commit is contained in:
Eric Hawicz authored and GitHub committed 2024-05-05 09:49:26 -04:00
commit 6e481aa061
1 file changed
+5
+5
View File
@@ -341,6 +341,11 @@ struct json_object *json_tokener_parse_ex(struct json_tokener *tok, const char *
#ifdef HAVE_USELOCALE #ifdef HAVE_USELOCALE
{ {
locale_t duploc = duplocale(oldlocale); locale_t duploc = duplocale(oldlocale);
if (duploc == NULL && errno == ENOMEM)
{
tok->err = json_tokener_error_memory;
return NULL;
}
newloc = newlocale(LC_NUMERIC_MASK, "C", duploc); newloc = newlocale(LC_NUMERIC_MASK, "C", duploc);
if (newloc == NULL) if (newloc == NULL)
{ {