Skip to content

Commit 7c9ae01

Browse files
committed
caja-information-panel: Fix use of memory after it is freed
to avoid warning with Clang Analyzer
1 parent 7b605dd commit 7c9ae01

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/caja-information-panel.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,9 @@ add_buttons_from_metadata (CajaInformationPanel *information_panel, const char *
945945
*temp_str = '\0';
946946
if (!g_ascii_strcasecmp (current_term, "button"))
947947
{
948+
if (button_name)
949+
g_free (button_name);
950+
948951
button_name = g_strdup (temp_str + 1);
949952
}
950953
else if (!g_ascii_strcasecmp (current_term, "script"))
@@ -958,7 +961,6 @@ add_buttons_from_metadata (CajaInformationPanel *information_panel, const char *
958961
0);
959962
information_panel->details->has_buttons = TRUE;
960963
command_string = g_strdup (temp_str + 1);
961-
g_free (button_name);
962964

963965
g_signal_connect_data (temp_button,
964966
"clicked",
@@ -975,6 +977,7 @@ add_buttons_from_metadata (CajaInformationPanel *information_panel, const char *
975977
}
976978
g_free(current_term);
977979
}
980+
g_free (button_name);
978981
g_strfreev (terms);
979982
}
980983

0 commit comments

Comments
 (0)