]> granicus.if.org Git - icu/commit
ICU-20041 Improve handling of OOM failures in NumberingSystem class. (#19)
authorJeff Genovy <29107334+jefgen@users.noreply.github.com>
Thu, 2 Aug 2018 23:23:07 +0000 (16:23 -0700)
committerShane Carr <shane@unicode.org>
Thu, 27 Sep 2018 21:27:37 +0000 (14:27 -0700)
commitd07396f94d92d24b62b47d146be7f9f411e90d9d
treeffae7f14cd0d75ee2681d85dfbe8ec228ab04abb
parent3712aa3d6e1d0e00249773c8541debf826c3bbb2
ICU-20041 Improve handling of OOM failures in NumberingSystem class. (#19)

ICU-20041 ICU4C NumberingSystem class doesn't handle out-of-memory (OOM) failures.

- Not all code paths in the NumberingSystem class check for OOM failures. This can lead to crashes in some cases as null pointers will be dereferenced without any checks.
- Change to use nullptr instead of NULL.
- Don't stomp on OOM errors when attempting to load resources. We should report back OOM to the caller.
- Use LocalPointer in order simplify the code and for automatic clean-up of memory.
- Use LocalUResourceBundlePointer as well to help simply things even more.
icu4c/source/i18n/numsys.cpp
icu4c/source/i18n/numsys_impl.h