summaryrefslogtreecommitdiffstats
path: root/icu/src/main/native
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2010-03-29 20:51:48 -0700
committerElliott Hughes <enh@google.com>2010-03-29 20:51:48 -0700
commit7ca6fd0dca02f7abdd8808db78357743bbdd23a5 (patch)
treeb44b5d779ad41c1ba367c95764b5d8fefaa26836 /icu/src/main/native
parent3314eef71dbd0ed6d8aa96fb99432ff125cc4121 (diff)
downloadlibcore-7ca6fd0dca02f7abdd8808db78357743bbdd23a5.zip
libcore-7ca6fd0dca02f7abdd8808db78357743bbdd23a5.tar.gz
libcore-7ca6fd0dca02f7abdd8808db78357743bbdd23a5.tar.bz2
Fix a bug, and protect against an unrelated class of bugs.
If the Java array allocation in InetAddress.cpp failed, we'd free NULL instead of the previously-allocated structure. This is a new bug in froyo, but only happens in out of memory situations, so doesn't seem worth fixing there. Unrelatedly, let's disallow assignment and copying of all our RAII classes. This isn't a mistake I've seen made, but it's easy to protect against, so we may as well do so consistently. Change-Id: I2433b31ff983d388788b09e59e08d661f1725ecd
Diffstat (limited to 'icu/src/main/native')
-rw-r--r--icu/src/main/native/Resources.cpp4
-rw-r--r--icu/src/main/native/ScopedJavaUnicodeString.h4
2 files changed, 8 insertions, 0 deletions
diff --git a/icu/src/main/native/Resources.cpp b/icu/src/main/native/Resources.cpp
index 9dbdb3d..1dd4bff 100644
--- a/icu/src/main/native/Resources.cpp
+++ b/icu/src/main/native/Resources.cpp
@@ -58,6 +58,10 @@ public:
private:
UResourceBundle* mBundle;
+
+ // Disallow copy and assignment.
+ ScopedResourceBundle(const ScopedResourceBundle&);
+ void operator=(const ScopedResourceBundle&);
};
static Locale getLocale(JNIEnv* env, jstring locale) {
diff --git a/icu/src/main/native/ScopedJavaUnicodeString.h b/icu/src/main/native/ScopedJavaUnicodeString.h
index 44952b4..69726fb 100644
--- a/icu/src/main/native/ScopedJavaUnicodeString.h
+++ b/icu/src/main/native/ScopedJavaUnicodeString.h
@@ -46,6 +46,10 @@ private:
jstring mString;
const UChar* mChars;
UnicodeString mUnicodeString;
+
+ // Disallow copy and assignment.
+ ScopedJavaUnicodeString(const ScopedJavaUnicodeString&);
+ void operator=(const ScopedJavaUnicodeString&);
};
#endif // SCOPED_JAVA_UNICODE_STRING_H_included