summaryrefslogtreecommitdiffstats
path: root/tools/aapt
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-10-29 15:25:52 -0700
committerAdam Lesinski <adamlesinski@google.com>2014-01-27 10:31:08 -0800
commitb30296b5fda75bf383c7ab3f567eb41820747869 (patch)
tree1c6745cc073dcaa88b2840e24623079018c0135f /tools/aapt
parent2675f769673f69b0661ddee346292f25cb30a296 (diff)
downloadframeworks_base-b30296b5fda75bf383c7ab3f567eb41820747869.zip
frameworks_base-b30296b5fda75bf383c7ab3f567eb41820747869.tar.gz
frameworks_base-b30296b5fda75bf383c7ab3f567eb41820747869.tar.bz2
Re-apply several tools fixes lost by the directory rearrangement.
Leaks on error in tools/aapt/Images.cpp. https://code.google.com/p/android/issues/detail?id=61552 Two missing fclose calls in tools/aapt/Resource.cpp. https://code.google.com/p/android/issues/detail?id=61553 Missing fclose in tools/aidl/aidl.cpp. https://code.google.com/p/android/issues/detail?id=61554 Change-Id: I56ce144958296961b77354815efc1a245564594b
Diffstat (limited to 'tools/aapt')
-rw-r--r--tools/aapt/Images.cpp14
-rw-r--r--tools/aapt/Resource.cpp4
2 files changed, 8 insertions, 10 deletions
diff --git a/tools/aapt/Images.cpp b/tools/aapt/Images.cpp
index 8947597..b1a548e 100644
--- a/tools/aapt/Images.cpp
+++ b/tools/aapt/Images.cpp
@@ -462,8 +462,8 @@ static status_t do_9patch(const char* imageName, image_info* image)
int maxSizeXDivs = W * sizeof(int32_t);
int maxSizeYDivs = H * sizeof(int32_t);
- int32_t* xDivs = (int32_t*) malloc(maxSizeXDivs);
- int32_t* yDivs = (int32_t*) malloc(maxSizeYDivs);
+ int32_t* xDivs = image->info9Patch.xDivs = (int32_t*) malloc(maxSizeXDivs);
+ int32_t* yDivs = image->info9Patch.yDivs = (int32_t*) malloc(maxSizeYDivs);
uint8_t numXDivs = 0;
uint8_t numYDivs = 0;
int8_t numColors;
@@ -520,6 +520,10 @@ static status_t do_9patch(const char* imageName, image_info* image)
goto getout;
}
+ // Copy patch size data into image...
+ image->info9Patch.numXDivs = numXDivs;
+ image->info9Patch.numYDivs = numYDivs;
+
// Find left and right of padding area...
if (get_horizontal_ticks(image->rows[H-1], W, transparent, false, &image->info9Patch.paddingLeft,
&image->info9Patch.paddingRight, &errorMsg, NULL, false) != NO_ERROR) {
@@ -555,12 +559,6 @@ static status_t do_9patch(const char* imageName, image_info* image)
image->layoutBoundsRight, image->layoutBoundsBottom));
}
- // Copy patch data into image
- image->info9Patch.numXDivs = numXDivs;
- image->info9Patch.numYDivs = numYDivs;
- image->info9Patch.xDivs = xDivs;
- image->info9Patch.yDivs = yDivs;
-
// If padding is not yet specified, take values from size.
if (image->info9Patch.paddingLeft < 0) {
image->info9Patch.paddingLeft = xDivs[0];
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index 08ad7a0..8f43661 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -2219,10 +2219,10 @@ status_t writeResourceSymbols(Bundle* bundle, const sp<AaptAssets>& assets,
status_t err = writeSymbolClass(fp, assets, includePrivate, symbols,
className, 0, bundle->getNonConstantId());
+ fclose(fp);
if (err != NO_ERROR) {
return err;
}
- fclose(fp);
if (textSymbolsDest != NULL && R == className) {
String8 textDest(textSymbolsDest);
@@ -2241,10 +2241,10 @@ status_t writeResourceSymbols(Bundle* bundle, const sp<AaptAssets>& assets,
status_t err = writeTextSymbolClass(fp, assets, includePrivate, symbols,
className);
+ fclose(fp);
if (err != NO_ERROR) {
return err;
}
- fclose(fp);
}
// If we were asked to generate a dependency file, we'll go ahead and add this R.java