From d67b177ff6a6dbbd950f1aaa84669351d6f26b9e Mon Sep 17 00:00:00 2001 From: Ramkumar Radhakrishnan Date: Wed, 18 May 2016 18:56:05 -0700 Subject: [PATCH] SF: Fix NULL pointer dereferencing in dumpDrawCycle() Check for NULL before dereferencing a pointer in dumpDrawCycle() Change-Id: I1f06214577d0065c988877acb0f1b4378080690f CRs-Fixed: 1018335 --- services/surfaceflinger/ExSurfaceFlinger/ExSurfaceFlinger.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/surfaceflinger/ExSurfaceFlinger/ExSurfaceFlinger.cpp b/services/surfaceflinger/ExSurfaceFlinger/ExSurfaceFlinger.cpp index 96d4b1d1e..7be0328b6 100644 --- a/services/surfaceflinger/ExSurfaceFlinger/ExSurfaceFlinger.cpp +++ b/services/surfaceflinger/ExSurfaceFlinger/ExSurfaceFlinger.cpp @@ -335,6 +335,10 @@ void ExSurfaceFlinger::dumpDrawCycle(bool prePrepare) { gettimeofday(&tv, NULL); ptm = localtime(&tv.tv_sec); + if (ptm == NULL) { + return; + } + strftime (hms, sizeof (hms), "%H:%M:%S", ptm); millis = tv.tv_usec / 1000; snprintf(timeStamp, sizeof(timeStamp), "Timestamp: %s.%03ld", hms, millis);