Bug 1476340: Fix DEAD_STORE errors in security/sandbox/linux/*. r?gcp
MozReview-Commit-ID: 3jNPRWGb7rU
--- a/security/sandbox/linux/SandboxOpenedFiles.cpp
+++ b/security/sandbox/linux/SandboxOpenedFiles.cpp
@@ -33,17 +33,17 @@ SandboxOpenedFile::SandboxOpenedFile(con
mExpectError = true;
}
mMaybeFd = fd;
}
int
SandboxOpenedFile::GetDesc() const
{
- int fd = -1;
+ int fd;
if (mDup) {
fd = mMaybeFd;
if (fd >= 0) {
fd = dup(fd);
if (fd < 0) {
SANDBOX_LOG_ERROR("dup: %s", strerror(errno));
}
}
--- a/security/sandbox/linux/broker/SandboxBrokerPolicyFactory.cpp
+++ b/security/sandbox/linux/broker/SandboxBrokerPolicyFactory.cpp
@@ -120,16 +120,19 @@ AddPathsFromFile(SandboxBroker::Policy*
nsCOMPtr<nsILineInputStream> lineStream(do_QueryInterface(fileStream, &rv));
if (NS_FAILED(rv)) {
return;
}
nsAutoCString line;
bool more = true;
do {
rv = lineStream->ReadLine(line, &more);
+ if (NS_FAILED(rv)) {
+ break;
+ }
// Cut off any comments at the end of the line, also catches lines
// that are entirely a comment
int32_t hash = line.FindChar('#');
if (hash >= 0) {
line = Substring(line, 0, hash);
}
// Simplify our following parsing by trimming whitespace
line.CompressWhitespace(true, true);