Fix some issues detected by Valgrind Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
@@ -42,7 +42,7 @@ static IKeyIndex *openKeyFile(IDistributedFilePart *keyFile)
{
StringBuffer remotePath;
rfn.getRemotePath(remotePath);
- unsigned crc;
+ unsigned crc = 0;
keyFile->getCrc(crc);
return createKeyIndex(remotePath.str(), crc, false, false);
}
@@ -51,7 +51,7 @@ static IKeyIndex *openKeyFile(IDistributedFilePart & keyFile)
keyFile.getCrc(crc);
@@ -2141,7 +2141,7 @@ public:
assertex(numParts > 0);
IPartDescriptor *pdesc = fdesc->queryPart(numParts - 1);
Owned<ILazyFileIO> keyFile = createDynamicFile(subNames.item(idx), pdesc, ROXIE_KEY, numParts);
pdesc->getCrc(crc);
StringBuffer pname;
pdesc->getPath(pname);
@@ -29468,9 +29468,11 @@ public:
loop
char c0 = *val++;
- char c1 = *val++;
- if (!c0 || !c1)
+ if (!c0)
break;
+ char c1 = *val++;
+ if (!c1)
+ break; // Shouldn't really happen - we expect even length
unsigned c2 = (hex2digit(c0) << 4) | hex2digit(c1);
result.append((unsigned char) c2);