haproxy/include/proto/mworker.h
Tim Duesterhus 9b7a976cd6 BUG/MINOR: mworker: Fix memory leak of mworker_proc members
The struct mworker_proc is not uniformly freed everywhere, sometimes leading
to leaks of the `id` string (and possibly the other strings).

Introduce a mworker_free_child function instead of duplicating the freeing
logic everywhere to prevent this kind of issues.

This leak was reported in issue #96.

It looks like the leaks have been introduced in commit 9a1ee7ac31,
which is specific to 2.0-dev. Backporting `mworker_free_child` might be
helpful to ease backporting other fixes, though.
2019-05-22 11:29:18 +02:00

42 lines
981 B
C

/*
* Master Worker
*
* Copyright HAProxy Technologies 2019 - William Lallemand <wlallemand@haproxy.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
*/
#ifndef PROTO_MWORKER_H_
#define PROTO_MWORKER_H_
#include <types/signal.h>
void mworker_proc_list_to_env();
void mworker_env_to_proc_list();
void mworker_block_signals();
void mworker_unblock_signals();
void mworker_catch_sighup(struct sig_handler *sh);
void mworker_catch_sigterm(struct sig_handler *sh);
void mworker_catch_sigchld(struct sig_handler *sh);
void mworker_accept_wrapper(int fd);
void mworker_cleanlisteners();
int mworker_child_nb();
int mworker_ext_launch_all();
void mworker_kill_max_reloads(int sig);
void mworker_free_child(struct mworker_proc *);
#endif /* PROTO_MWORKER_H_ */