diff --git a/libcxx/include/locale b/libcxx/include/locale --- a/libcxx/include/locale +++ b/libcxx/include/locale @@ -1567,7 +1567,7 @@ __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v); else __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v); - if (__nb == nullptr) + if (__nc == -1) __throw_bad_alloc(); __nbh.reset(__nb); } @@ -1618,7 +1618,7 @@ __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v); else __nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v); - if (__nb == nullptr) + if (__nc == -1) __throw_bad_alloc(); __nbh.reset(__nb); } @@ -3399,7 +3399,7 @@ if (__n > __bs-1) { __n = static_cast(__libcpp_asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units)); - if (__bb == nullptr) + if (__n == -1) __throw_bad_alloc(); __hn.reset(__bb); __hd.reset((char_type*)malloc(__n * sizeof(char_type)));