Index: C:/ROS/reactos/base/applications/cmdutils/comp/comp.c =================================================================== --- base/applications/cmdutils/comp/comp.c (revision 63110) +++ base/applications/cmdutils/comp/comp.c (working copy) @@ -67,6 +67,13 @@ bAscii = FALSE, // /A switch bLineNos = FALSE; // /L switch + if (Line1 == NULL || + Line2 == NULL) + { + _tprintf(_T("Could not allocate memory required to perform compare\n")); + return EXIT_FAILURE; + } + /* parse command line for options */ for (i = 1; i < argc; i++) { @@ -81,10 +88,14 @@ _tprintf(_T("/l not supported\n")); (void)bLineNos; /*FIXME: needs adding */ break; case '?': Usage(); + free(Line1); + free(Line2); return EXIT_SUCCESS; default: _tprintf(_T("Invalid switch - /%c\n"), argv[i][1]); Usage(); + free(Line1); + free(Line2); return EXIT_FAILURE; } } @@ -134,6 +145,8 @@ break; default : _tprintf(_T("Bad command line syntax\n")); + free(Line1); + free(Line2); return EXIT_FAILURE; break; } @@ -143,12 +156,16 @@ if ((fp1 = fopen(File1, "r")) == NULL) { _tprintf(_T("Can't find/open file: %s\n"), File1); + free(Line1); + free(Line2); return EXIT_FAILURE; } if ((fp2 = fopen(File2, "r")) == NULL) { _tprintf(_T("Can't find/open file: %s\n"), File2); fclose(fp1); + free(Line1); + free(Line2); return EXIT_FAILURE; } @@ -174,8 +191,9 @@ fclose(fp1); fclose(fp2); + free(Line1); + free(Line2); - return EXIT_SUCCESS; } /* EOF */