summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Greg Kaiser <gkaiser@google.com> 2019-03-11 14:09:53 -0700
committer Marco Nelissen <marcone@google.com> 2019-07-17 11:21:07 -0700
commit2dc7b47e885d89e38875243a30ac7a68ac0d84a5 (patch)
treece7401672631d5f6a8f0d69ab38e9e0999ee7cbd
parente1bff7cf42df01521fbe8e53538e9f91b21ebd36 (diff)
cmds/service: Fix categoryCount
By introducing a new 'categoryCount' in an inner scope, and only incrementing it within this inner scope, we're assured that when we leave this scope, our "if (categoryCount > 0)" will always be false, not matter how 'categories' we added. This almost certainly is not the intention of this code, so we removing the inner scope declaration of the variable, so that 'categoryCount' will be updated. Bug: 28288587 Test: TreeHugger Change-Id: Ie592a02c5baa1eb5527ddd8d726e3b1181d937fd Merged-In: Ie592a02c5baa1eb5527ddd8d726e3b1181d937fd
-rw-r--r--cmds/service/service.cpp1
1 files changed, 0 insertions, 1 deletions
diff --git a/cmds/service/service.cpp b/cmds/service/service.cpp
index 8a33dd227a..543357c564 100644
--- a/cmds/service/service.cpp
+++ b/cmds/service/service.cpp
@@ -232,7 +232,6 @@ int main(int argc, char* const argv[])
else if (strcmp(key, "categories") == 0)
{
char* context2 = nullptr;
- int categoryCount = 0;
categories[categoryCount] = strtok_r(value, ",", &context2);
while (categories[categoryCount] != nullptr)