SF: Fix NULL pointer dereferencing in dumpDrawCycle()

Check for NULL before dereferencing a pointer in dumpDrawCycle()

Change-Id: I1f06214577d0065c988877acb0f1b4378080690f
CRs-Fixed: 1018335
This commit is contained in:
Ramkumar Radhakrishnan 2016-05-18 18:56:05 -07:00 committed by Steve Kondik
parent a887c19994
commit d67b177ff6

View File

@ -335,6 +335,10 @@ void ExSurfaceFlinger::dumpDrawCycle(bool prePrepare) {
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
ptm = localtime(&tv.tv_sec); ptm = localtime(&tv.tv_sec);
if (ptm == NULL) {
return;
}
strftime (hms, sizeof (hms), "%H:%M:%S", ptm); strftime (hms, sizeof (hms), "%H:%M:%S", ptm);
millis = tv.tv_usec / 1000; millis = tv.tv_usec / 1000;
snprintf(timeStamp, sizeof(timeStamp), "Timestamp: %s.%03ld", hms, millis); snprintf(timeStamp, sizeof(timeStamp), "Timestamp: %s.%03ld", hms, millis);