]> git.saurik.com Git - android/aapt.git/commitdiff
Create own reference for minSdkVersion in aapt
authorKenny Root <kroot@google.com>
Thu, 25 Feb 2010 07:49:59 +0000 (23:49 -0800)
committerKenny Root <kroot@google.com>
Thu, 25 Feb 2010 07:49:59 +0000 (23:49 -0800)
Fix bug where applications defining a minSdkVersion were experiencing
transient errors from memory corruption in aapt.

Change-Id: I839d5eda7388baac6133e735fa59f9799ca2822d

Resource.cpp

index f8c5c38462ac8c09cdd33bc570eed3921def933b..ae4bd142583505ab72d97a573598731d14a3fd13 100644 (file)
@@ -224,9 +224,9 @@ static status_t parsePackage(Bundle* bundle, const sp<AaptAssets>& assets,
                 ssize_t minSdkIndex = block.indexOfAttribute(RESOURCES_ANDROID_NAMESPACE,
                                                              "minSdkVersion");
                 if (minSdkIndex >= 0) {
-                    String8 minSdkString = String8(
-                        block.getAttributeStringValue(minSdkIndex, &len));
-                    bundle->setMinSdkVersion(minSdkString.string());
+                    const uint16_t* minSdk16 = block.getAttributeStringValue(minSdkIndex, &len);
+                    const char* minSdk8 = strdup(String8(minSdk16).string());
+                    bundle->setMinSdkVersion(minSdk8);
                 }
             }
         }