/* Stuff the pointer into the penultimate element of the array, which
is the one at the index specified by "*argc". */
- args[*argc] = arg;
-
+ args[*argc] = g_strdup(arg);
/* Now bump the count. */
(*argc)++;
/* Couldn't create the pipe between parent and child. */
report_failure("Couldn't create sync pipe: %s",
win32strerror(GetLastError()));
- g_free( (gpointer) argv[0]);
+ for (i = 0; i < argc; i++) {
+ g_free( (gpointer) argv[i]);
+ }
g_free( (gpointer) argv);
return FALSE;
}
/* Couldn't create the signal pipe between parent and child. */
report_failure("Couldn't create signal pipe: %s",
win32strerror(GetLastError()));
- g_free( (gpointer) argv[0]);
+ for (i = 0; i < argc; i++) {
+ g_free( (gpointer) argv[i]);
+ }
g_free( (gpointer) argv);
return FALSE;
}
args->str, win32strerror(GetLastError()));
CloseHandle(sync_pipe_read);
CloseHandle(sync_pipe_write);
- g_free( (gpointer) argv[0]);
+ for (i = 0; i < argc; i++) {
+ g_free( (gpointer) argv[i]);
+ }
g_free( (gpointer) argv);
return FALSE;
}
if (pipe(sync_pipe) < 0) {
/* Couldn't create the pipe between parent and child. */
report_failure("Couldn't create sync pipe: %s", g_strerror(errno));
- g_free( (gpointer) argv[0]);
+ for (i = 0; i < argc; i++) {
+ g_free( (gpointer) argv[i]);
+ }
g_free(argv);
return FALSE;
}
sync_pipe_read_fd = sync_pipe[PIPE_READ];
#endif
- g_free( (gpointer) argv[0]); /* exename */
+ for (i = 0; i < argc; i++) {
+ g_free( (gpointer) argv[i]);
+ }
/* Parent process - read messages from the child process over the
sync pipe. */
SECURITY_ATTRIBUTES sa;
STARTUPINFO si;
PROCESS_INFORMATION pi;
- int i;
#else
char errmsg[1024+1];
int sync_pipe[2]; /* pipe used to send messages from child to parent */
int data_pipe[2]; /* pipe used to send data from child to parent */
#endif
-
+ int i;
*fork_child = -1;
*data_read_fd = -1;
*message_read_fd = -1;
/* Couldn't create the message pipe between parent and child. */
*msg = g_strdup_printf("Couldn't create sync pipe: %s",
win32strerror(GetLastError()));
- g_free( (gpointer) argv[0]);
+ for (i = 0; argv[i] != NULL; i++) {
+ g_free( (gpointer) argv[i]);
+ }
g_free( (gpointer) argv);
return -1;
}
win32strerror(GetLastError()));
CloseHandle(sync_pipe[PIPE_READ]);
CloseHandle(sync_pipe[PIPE_WRITE]);
- g_free( (gpointer) argv[0]);
+ for (i = 0; argv[i] != NULL; i++) {
+ g_free( (gpointer) argv[i]);
+ }
g_free( (gpointer) argv);
return -1;
}
CloseHandle(data_pipe[PIPE_WRITE]);
CloseHandle(sync_pipe[PIPE_READ]);
CloseHandle(sync_pipe[PIPE_WRITE]);
- g_free( (gpointer) argv[0]);
+ for (i = 0; argv[i] != NULL; i++) {
+ g_free( (gpointer) argv[i]);
+ }
g_free( (gpointer) argv);
return -1;
}
if (pipe(sync_pipe) < 0) {
/* Couldn't create the message pipe between parent and child. */
*msg = g_strdup_printf("Couldn't create sync pipe: %s", g_strerror(errno));
- g_free( (gpointer) argv[0]);
+ for (i = 0; argv[i] != NULL; i++) {
+ g_free( (gpointer) argv[i]);
+ }
g_free(argv);
return -1;
}
*msg = g_strdup_printf("Couldn't create data pipe: %s", g_strerror(errno));
ws_close(sync_pipe[PIPE_READ]);
ws_close(sync_pipe[PIPE_WRITE]);
- g_free( (gpointer) argv[0]);
+ for (i = 0; argv[i] != NULL; i++) {
+ g_free( (gpointer) argv[i]);
+ }
g_free(argv);
return -1;
}
*message_read_fd = sync_pipe[PIPE_READ];
#endif
- g_free( (gpointer) argv[0]); /* exename */
+ for (i = 0; argv[i] != NULL; i++) {
+ g_free( (gpointer) argv[i]);
+ }
/* Parent process - read messages from the child process over the
sync pipe. */