]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/tools/icupkg/icupkg.cpp
ICU-511.25.tar.gz
[apple/icu.git] / icuSources / tools / icupkg / icupkg.cpp
index eb198fdedc8f83da0f652a2c1620cbe472813e02..4ae7ac4983eee9c3849a583db578991b5ab1f6fc 100644 (file)
@@ -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 {