mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-28 08:01:26 +00:00
replay: do not use argv after g_option_context_parse
Apparently, after using g_option_context_parse with G_OPTION_REMAINING argv is modified and should not be used. This patch uses "file" instead of "argv" and makes sure file is freed later. No free is called upon error - exit takes care of it.
This commit is contained in:
parent
aa5a5fa630
commit
d82b8b0789
@ -350,12 +350,12 @@ int main(int argc, char **argv)
|
||||
} else {
|
||||
fd = fopen(file[0], "r");
|
||||
}
|
||||
if (fd == NULL) {
|
||||
g_printerr("error opening %s\n", file[0]);
|
||||
exit(1);
|
||||
}
|
||||
g_strfreev(file);
|
||||
file = NULL;
|
||||
if (fd == NULL) {
|
||||
g_printerr("error opening %s\n", argv[1]);
|
||||
return 1;
|
||||
}
|
||||
if (fcntl(fileno(fd), FD_CLOEXEC) < 0) {
|
||||
perror("fcntl failed");
|
||||
exit(1);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user