mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof: plug leak and do less strdups
Small leak based on the number of PROCESS frames we see. Easy to fix and easy to not do the g_strdup_printf() at all in those cases.
This commit is contained in:
@ -275,7 +275,6 @@ sysprof_callgraph_profile_generate_worker (GTask *task,
|
||||
while (sysprof_capture_reader_peek_type (reader, &type))
|
||||
{
|
||||
const SysprofCaptureProcess *pr;
|
||||
const gchar *cmdline;
|
||||
|
||||
if (type != SYSPROF_CAPTURE_FRAME_PROCESS)
|
||||
{
|
||||
@ -287,10 +286,13 @@ sysprof_callgraph_profile_generate_worker (GTask *task,
|
||||
if (NULL == (pr = sysprof_capture_reader_read_process (reader)))
|
||||
goto failure;
|
||||
|
||||
cmdline = g_strdup_printf ("[%s]", pr->cmdline);
|
||||
g_hash_table_insert (cmdlines,
|
||||
GINT_TO_POINTER (pr->frame.pid),
|
||||
(gchar *)sysprof_callgraph_profile_intern_string (self, cmdline));
|
||||
if (!g_hash_table_contains (cmdlines, GINT_TO_POINTER (pr->frame.pid)))
|
||||
{
|
||||
g_autofree gchar *cmdline = g_strdup_printf ("[%s]", pr->cmdline);
|
||||
g_hash_table_insert (cmdlines,
|
||||
GINT_TO_POINTER (pr->frame.pid),
|
||||
(gchar *)sysprof_callgraph_profile_intern_string (self, cmdline));
|
||||
}
|
||||
}
|
||||
|
||||
if (g_task_return_error_if_cancelled (task))
|
||||
|
||||
Reference in New Issue
Block a user