mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-09-19 13:30:02 +00:00
testsuite: fix memleak
Also use the actual diff command we found instead of searching for it again.
This commit is contained in:
parent
fd5d15004e
commit
8860a2a688
@ -34,14 +34,16 @@ diff_with_file (const char *file1,
|
|||||||
gssize len,
|
gssize len,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
const char *command[] = { "diff", "-u", file1, NULL, NULL };
|
char *diff_cmd, *diff, *tmpfile;
|
||||||
char *diff, *tmpfile;
|
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
diff = NULL;
|
diff = NULL;
|
||||||
|
|
||||||
if (g_find_program_in_path ("diff"))
|
diff_cmd = g_find_program_in_path ("diff");
|
||||||
|
if (diff_cmd)
|
||||||
{
|
{
|
||||||
|
const char *command[] = { diff_cmd, "-u", file1, NULL, NULL };
|
||||||
|
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
len = strlen (text);
|
len = strlen (text);
|
||||||
|
|
||||||
@ -65,7 +67,7 @@ diff_with_file (const char *file1,
|
|||||||
g_spawn_sync (NULL,
|
g_spawn_sync (NULL,
|
||||||
(char **) command,
|
(char **) command,
|
||||||
NULL,
|
NULL,
|
||||||
G_SPAWN_SEARCH_PATH,
|
0,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
&diff,
|
&diff,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
@ -74,6 +76,7 @@ diff_with_file (const char *file1,
|
|||||||
done:
|
done:
|
||||||
g_unlink (tmpfile);
|
g_unlink (tmpfile);
|
||||||
g_free (tmpfile);
|
g_free (tmpfile);
|
||||||
|
g_free (diff_cmd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user