Check for null ferr

fout is double checked for nullptr instead of ferr which forces
to call fclose on null ferr.

Test: atest incidentd_test
Test: m incidentd_service_fuzzer && adb sync data && adb shell /data/fuzz/x86_64/incidentd_service_fuzzer/incidentd_service_fuzzer
with clusterfuzz testcase
Bug: 283453191

Change-Id: I3a4912cf70f4f32cb66fb870febbbfff1a7c6adc
diff --git a/cmds/incidentd/src/IncidentService.cpp b/cmds/incidentd/src/IncidentService.cpp
index c2f0100..05a43ad 100644
--- a/cmds/incidentd/src/IncidentService.cpp
+++ b/cmds/incidentd/src/IncidentService.cpp
@@ -536,7 +536,7 @@
                 fflush(fout);
                 fclose(fout);
             }
-            if (fout != NULL) {
+            if (ferr != NULL) {
                 fflush(ferr);
                 fclose(ferr);
             }