Browse Source

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

Handle yet another out-of-memory condition.
tags/json-c-0.18-20240915
Eric Hawicz GitHub 1 year ago
parent
commit
6e481aa061
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      json_tokener.c

+ 5
- 0
json_tokener.c 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)
{ {


Loading…
Cancel
Save