flag was previously uninitialized, and if GetLogCategory() failed we'd drop through and |= whatever was in flag's memory with logCategories.
belt-and-braces: initialize flag to 0, and continue to next iteration of loop if GetLogCategories() fails.
pinging @gmaxwell