From c367d48c55e5a3fa0df14fd62889e4bb6b63cb01 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 29 Oct 2013 13:12:55 -0700 Subject: Fix a variety of small publicly-reported bugs. Possible NULL dereference in cmds/bootanimation/BootAnimation.cpp. https://code.google.com/p/android/issues/detail?id=61556 Missing fclose in core/jni/android_os_Debug.cpp. https://code.google.com/p/android/issues/detail?id=61546 Bad loop guards in core/jni/android_util_Process.cpp. https://code.google.com/p/android/issues/detail?id=61557 Assignment to wrong variable in libs/androidfw/AssetManager.cpp. https://code.google.com/p/android/issues/detail?id=61560 Missing delete[]s in libs/androidfw/ObbFile.cpp. https://code.google.com/p/android/issues/detail?id=61549 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: I5820f3824e72d07a9acb776cf0af3e7443f5694a --- tools/aidl/aidl.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'tools/aidl/aidl.cpp') diff --git a/tools/aidl/aidl.cpp b/tools/aidl/aidl.cpp index 071a8d771605..b5c3da908beb 100644 --- a/tools/aidl/aidl.cpp +++ b/tools/aidl/aidl.cpp @@ -207,7 +207,7 @@ check_filename(const char* filename, const char* package, buffer_type* name) p = strchr(name->data, '.'); len = p ? p-name->data : strlen(name->data); expected.append(name->data, len); - + expected += ".aidl"; len = fn.length(); @@ -473,7 +473,7 @@ check_method(const char* filename, int kind, method_type* m) err = 1; goto next; } - + if (!(kind == INTERFACE_TYPE_BINDER ? t->CanWriteToParcel() : t->CanWriteToRpcData())) { fprintf(stderr, "%s:%d parameter %d: '%s %s' can't be marshalled.\n", filename, m->type.type.lineno, index, @@ -536,7 +536,7 @@ check_method(const char* filename, int kind, method_type* m) filename, m->name.lineno, index, arg->name.data); err = 1; } - + next: index++; arg = arg->next; @@ -787,7 +787,7 @@ parse_preprocessed_file(const string& filename) //printf("%s:%d:...%s...%s...%s...\n", filename.c_str(), lineno, // type, packagename, classname); document_item_type* doc; - + if (0 == strcmp("parcelable", type)) { user_data_type* parcl = (user_data_type*)malloc( sizeof(user_data_type)); @@ -837,6 +837,7 @@ parse_preprocessed_file(const string& filename) else { fprintf(stderr, "%s:%d: bad type in line: %s\n", filename.c_str(), lineno, line); + fclose(f); return 1; } err = gather_types(filename.c_str(), doc); @@ -1093,13 +1094,13 @@ preprocess_aidl(const Options& options) } // write preprocessed file - int fd = open( options.outputFileName.c_str(), + int fd = open( options.outputFileName.c_str(), O_RDWR|O_CREAT|O_TRUNC|O_BINARY, #ifdef HAVE_MS_C_RUNTIME _S_IREAD|_S_IWRITE); -#else +#else S_IRUSR|S_IWUSR|S_IRGRP); -#endif +#endif if (fd == -1) { fprintf(stderr, "aidl: could not open file for write: %s\n", options.outputFileName.c_str()); -- cgit v1.2.3-59-g8ed1b