Index: mozilla/xpinstall/wizard/libxpnet/test/TestLibxpnet.cpp =================================================================== RCS file: /cvsroot/mozilla/xpinstall/wizard/libxpnet/test/TestLibxpnet.cpp,v retrieving revision 1.6 diff -pU10 -r1.6 mozilla/xpinstall/wizard/libxpnet/test/TestLibxpnet.cpp --- mozilla/xpinstall/wizard/libxpnet/test/TestLibxpnet.cpp +++ mozilla/xpinstall/wizard/libxpnet/test/TestLibxpnet.cpp @@ -196,50 +196,61 @@ main(int argc, char **argv) } /* or is this an FTP URL? */ else if (strncmp(argv[1], kFTP, strlen(kFTP)) == 0) { char *host = 0, *path = 0, *file = (char*) kLoclFile; int port = 21; rv = nsHTTPConn::ParseURL(kFTP, argv[1], &host, &port, &path); spew("nsHTTPConn::ParseURL", rv); + if (NS_FAILED(rv)) + return 1; nsFTPConn *conn = new nsFTPConn(host); + if (!conn) { + spew("OOM - nsFTPConn"); + return 1; + } rv = conn->Open(); spew("nsFTPConn::Open", rv); + if (NS_FAILED(rv)) + { + delete conn; + return 1; + } if (strrchr(path, '/') != (path + strlen(path))) file = strrchr(path, '/') + 1; // set to leaf name startTime = time(NULL); if (bResumeOrGet) { rv = conn->ResumeOrGet(path, file, nsFTPConn::BINARY, 1, ProgressCB); } else { rv = conn->Get(path, file, nsFTPConn::BINARY, resPos, 1, ProgressCB); } endTime = time(NULL); printf("\n"); // newline after progress completes spew("nsFTPConn::Get", rv); rv = conn->Close(); spew("nsFTPConn::Close", rv); + delete conn; if (host) free(host); - if (path) - free(path); + free(path); } /* or we don't understand the args */ else { fprintf(stderr, "Like, uhm, dude! I don't get you. "); fprintf(stderr, "See usage...\n"); usage(argv[0]); return 1; }