From 428871d0447dc6972d13ff8d52615b4faf81de39 Mon Sep 17 00:00:00 2001 From: Pawan Wagh Date: Fri, 19 May 2023 21:18:01 +0000 Subject: [PATCH] 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 --- cmds/incidentd/src/IncidentService.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmds/incidentd/src/IncidentService.cpp b/cmds/incidentd/src/IncidentService.cpp index c2f010097fdad..05a43ad7d9363 100644 --- a/cmds/incidentd/src/IncidentService.cpp +++ b/cmds/incidentd/src/IncidentService.cpp @@ -536,7 +536,7 @@ status_t IncidentService::onTransact(uint32_t code, const Parcel& data, Parcel* fflush(fout); fclose(fout); } - if (fout != NULL) { + if (ferr != NULL) { fflush(ferr); fclose(ferr); }