2f95561ff616d8660c93bfeab326763ddbb0f7c2 hiram Thu Jun 22 19:23:01 2023 -0700 free up the result from the query no redmine diff --git src/hg/geoIpToCountry/geoIpToCountry.c src/hg/geoIpToCountry/geoIpToCountry.c index fd8a130..010c3fb 100644 --- src/hg/geoIpToCountry/geoIpToCountry.c +++ src/hg/geoIpToCountry/geoIpToCountry.c @@ -75,64 +75,65 @@ if (fileList) { locHash = newHash(0); char *line; long long lineCount = 0; long long checked = 0; long long failed = 0; struct lineFile *lf = lineFileOpen(ipStr, TRUE); verbose(2, "# processing file list: %s\n", ipStr); verboseTimeInit(); while (lineFileNextReal(lf, &line)) { ++lineCount; - if (hashIncInt(locHash, line) > 1) + if (hashIncInt(locHash, line) > 1) // avoid duplicates continue; ++checked; char *country = geoMirrorCountry6(centralConn, line); if (strlen(country)==2) // ok { if (countryCode) { char *name = hashFindVal(countryCode, country); - verbose(2, "# looking %s found: '%s'\n", country, name); printf("%s\t%s\t'%s'\n", country, line, name); } else printf("%s\t%s\n", country, line); } else { printf("n/a\t%s\tfailed\n", line); ++failed; } + freeMem(country); } lineFileClose(&lf); verboseTime(0, "# processed %lld lines, checked %lld addresses, %lld failed", lineCount, checked, failed); } else { char *country = geoMirrorCountry6(centralConn, ipStr); if (strlen(country)==2) // ok { if (countryCode) { char *name = hashFindVal(countryCode, country); printf("%s\t%s\t%s\n", country, ipStr, name); } else printf("%s\t%s\n", country, ipStr); } else errAbort("unable to read IP address for %s, error message was: %s", ipStr, country); + freeMem(country); } // Leave it to others to extend it to process a list of things. // Example code for hostName lookup is in kent/src/utils/dnsInfo/dnsInfo.c return 0; }