Re: [PATCH v5 6/8] convert: rename reusable sub-process functions
- From
Lars Schneider <larsxschneider@gmail.com>
- Date
- Apr 10, 2017, 12:11 UTC
- Message-ID
- <1B2A2436-8BD4-4858-BC90-BCB1617D586B@gmail.com>
- In-Reply-To
- <20170407120354.17736-7-benpeart@microsoft.com>
Show 18 quoted lines
> On 07 Apr 2017, at 14:03, Ben Peart <peartben@gmail.com> wrote:
>
> Do a mechanical rename of the functions that will become the reusable
> sub-process module.
>
> Signed-off-by: Ben Peart <benpeart@microsoft.com>
> ---
> convert.c | 53 +++++++++++++++++++++++++++--------------------------
> 1 file changed, 27 insertions(+), 26 deletions(-)
>
> diff --git a/convert.c b/convert.c
> index 747c0c363b..235a6a5279 100644
> --- a/convert.c
> +++ b/convert.c
> @@ -507,8 +507,8 @@ struct cmd2process {
> unsigned int supported_capabilities;
> };
> > ...
Show 14 quoted lines
>
> -static void kill_multi_file_filter(struct subprocess_entry *entry)
> +static void subprocess_stop(struct subprocess_entry *entry)
> {
> if (!entry)
> return;
> @@ -561,14 +561,14 @@ static void kill_multi_file_filter(struct subprocess_entry *entry)
> kill(entry->process.pid, SIGTERM);
> finish_command(&entry->process);
>
> - hashmap_remove(&cmd_process_map, entry, NULL);
> + hashmap_remove(&subprocess_map, entry, NULL);
> free(entry);
> }> ...
Show 7 quoted lines
> @@ -777,7 +777,8 @@ static int apply_multi_file_filter(const char *path, const char *src, size_t len
> * Force shutdown and restart if another blob requires filtering.
> */
> error("external filter '%s' failed", cmd);
> - kill_multi_file_filter((struct subprocess_entry *)entry);
> + subprocess_stop((struct subprocess_entry *)entry);
> + free(entry);I think we perform a double "free" here and in subprocess_stop(), no? Everything else looks good to me!
Thanks, Lars