details-page: Protect against NULL line

On a Raspberry PI 4, Sysprof crashes immediately when
trying to memchr() on the 'line' variable. The current
RPI4 support is poor on Linux mainline admitedly, but
having Sysprof to work on it at least gives us a chance
to profile the major bottlenecks.

Protect against NULL 'line'.
This commit is contained in:
Georges Basile Stavracas Neto
2019-12-30 14:03:15 -03:00
parent 5388267e04
commit a67701848d

View File

@ -142,8 +142,12 @@ cpu_info_cb (const SysprofCaptureFrame *frame,
const gchar *line;
gchar **str = user_data;
endptr = (gchar *)fc->data + fc->len;
line = memmem ((gchar *)fc->data, fc->len, "model name", 10);
if (!line)
return FALSE;
endptr = (gchar *)fc->data + fc->len;
endptr = memchr (line, '\n', endptr - line);
if (endptr)