X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=libiberty%2Fpexecute.c;h=2dfcdda68d4f7463d0fa07de10efe1dc3163d93c;hb=refs%2Fheads%2Fconcurrent-displaced-stepping-2020-04-01;hp=f486252bd73a50a5a9bbd480e9f3316e118b6a2b;hpb=979c05d32447bf9388479ed6ef8e5665b40e5763;p=deliverable%2Fbinutils-gdb.git diff --git a/libiberty/pexecute.c b/libiberty/pexecute.c index f486252bd7..2dfcdda68d 100644 --- a/libiberty/pexecute.c +++ b/libiberty/pexecute.c @@ -1,6 +1,6 @@ /* Utilities to execute a program in a subprocess (possibly linked by pipes with other subprocesses), and wait for it. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004-2020 Free Software Foundation, Inc. This file is part of the libiberty library. Libiberty is free software; you can redistribute it and/or @@ -47,7 +47,7 @@ pexecute (const char *program, char * const *argv, const char *pname, { if (pex != NULL) { - *errmsg_fmt = "pexecute already in progress"; + *errmsg_fmt = (char *) "pexecute already in progress"; *errmsg_arg = NULL; return -1; } @@ -58,7 +58,7 @@ pexecute (const char *program, char * const *argv, const char *pname, { if (pex == NULL) { - *errmsg_fmt = "pexecute not in progress"; + *errmsg_fmt = (char *) "pexecute not in progress"; *errmsg_arg = NULL; return -1; } @@ -99,9 +99,12 @@ pwait (int pid, int *status, int flags ATTRIBUTE_UNUSED) { int *vector; - vector = xmalloc (idx * sizeof (int)); + vector = XNEWVEC (int, idx); if (!pex_get_status (pex, idx, vector)) - return -1; + { + free (vector); + return -1; + } *status = vector[pid]; free (vector); }