X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/729e4ab9bc6618bc3d8a898e575df7f4019e29ca..51004dcb01e06fef634b61be77ed73dd61cb6db9:/icuSources/tools/icupkg/icupkg.cpp?ds=sidebyside diff --git a/icuSources/tools/icupkg/icupkg.cpp b/icuSources/tools/icupkg/icupkg.cpp index eb198fde..4ae7ac49 100644 --- a/icuSources/tools/icupkg/icupkg.cpp +++ b/icuSources/tools/icupkg/icupkg.cpp @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 2005-2010, International Business Machines +* Copyright (C) 2005-2012, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -371,8 +371,12 @@ main(int argc, char *argv[]) { /* remove items */ if(options[OPT_REMOVE_LIST].doesOccur) { - listPkg=readList(NULL, options[OPT_REMOVE_LIST].value, FALSE); - if(listPkg!=NULL) { + listPkg=new Package(); + if(listPkg==NULL) { + fprintf(stderr, "icupkg: not enough memory\n"); + exit(U_MEMORY_ALLOCATION_ERROR); + } + if(readList(NULL, options[OPT_REMOVE_LIST].value, FALSE, listPkg)) { pkg->removeItems(*listPkg); delete listPkg; isModified=TRUE; @@ -389,8 +393,12 @@ main(int argc, char *argv[]) { */ addListPkg=NULL; if(options[OPT_ADD_LIST].doesOccur) { - addListPkg=readList(sourcePath, options[OPT_ADD_LIST].value, TRUE); - if(addListPkg!=NULL) { + addListPkg=new Package(); + if(addListPkg==NULL) { + fprintf(stderr, "icupkg: not enough memory\n"); + exit(U_MEMORY_ALLOCATION_ERROR); + } + if(readList(sourcePath, options[OPT_ADD_LIST].value, TRUE, addListPkg)) { pkg->addItems(*addListPkg); // delete addListPkg; deferred until after writePackage() isModified=TRUE; @@ -402,8 +410,12 @@ main(int argc, char *argv[]) { /* extract items */ if(options[OPT_EXTRACT_LIST].doesOccur) { - listPkg=readList(NULL, options[OPT_EXTRACT_LIST].value, FALSE); - if(listPkg!=NULL) { + listPkg=new Package(); + if(listPkg==NULL) { + fprintf(stderr, "icupkg: not enough memory\n"); + exit(U_MEMORY_ALLOCATION_ERROR); + } + if(readList(NULL, options[OPT_EXTRACT_LIST].value, FALSE, listPkg)) { pkg->extractItems(destPath, *listPkg, outType); delete listPkg; } else {