--- abiword-2.5.1/po/po2str.c~ 2006-05-14 10:13:26.000000000 -0700 +++ abiword-2.5.1/po/po2str.c 2007-08-08 12:59:08.000000000 -0700 @@ -338,6 +338,11 @@ return -1; } pBytes = malloc(iFileSize); + if (pBytes == NULL ) + { + fprintf(stderr, "Error not enough memory to read file: %s\n", argv[1] ); + return -1; + } fp = fopen(argv[1], "rb"); fread( pBytes, sizeof(char), iFileSize, fp); fclose(fp); @@ -351,7 +356,13 @@ /* Allocate Memory for array */ pTags = malloc( sizeof(OutputData) * numTags ); - _LoadTagData( pStartofTags, pTags ); + if (pTags == NULL ) + { + free( pBytes ); + fprintf(stderr, "Error not enough memory to load tags\n" ); + return -1; + } + _LoadTagData( pStartofTags, pTags ); /* Sort the Array */ qsort( pTags, numTags, sizeof(OutputData), (void *)comp_data ); @@ -372,5 +383,3 @@ return 0; } - -