From: Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>
To: The list for a Better Approach To Mobile Ad-hoc Networking
<b.a.t.m.a.n@lists.open-mesh.org>
Subject: Re: [B.A.T.M.A.N.] [PATCH] alfred: free globals. Fixes memory leak
Date: Mon, 9 Sep 2013 17:08:31 +0200 [thread overview]
Message-ID: <20130909150831.GA11737@pandem0nium> (raw)
In-Reply-To: <1378690742-19656-1-git-send-email-nils@nilsschneider.net>
[-- Attachment #1: Type: text/plain, Size: 1324 bytes --]
On Mon, Sep 09, 2013 at 03:39:02AM +0200, Nils Schneider wrote:
> ---
> main.c | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/main.c b/main.c
> index 86acfb7..58622f8 100644
> --- a/main.c
> +++ b/main.c
> @@ -142,6 +142,7 @@ static struct globals *alfred_init(int argc, char *argv[])
> int main(int argc, char *argv[])
> {
> struct globals *globals;
> + int ret;
>
> globals = alfred_init(argc, argv);
>
> @@ -150,15 +151,21 @@ int main(int argc, char *argv[])
>
> switch (globals->clientmode) {
> case CLIENT_NONE:
> - return alfred_server(globals);
> + ret = alfred_server(globals);
> break;
> case CLIENT_REQUEST_DATA:
> - return alfred_client_request_data(globals);
> + ret = alfred_client_request_data(globals);
> break;
> case CLIENT_SET_DATA:
> - return alfred_client_set_data(globals);
> + ret = alfred_client_set_data(globals);
> break;
> + default:
> + ret = 0;
> }
>
> - return 0;
> + free(globals->interface);
> + free(globals->mesh_iface);
> + free(globals);
> +
> + return ret;
Hrm, apart from that this patch lacks a commit message and signoff, what does it help
freeing stuff just before the program exits? This will free anything automatically
anyway ...
Cheers,
Simon
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2013-09-09 15:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-09 1:39 [B.A.T.M.A.N.] [PATCH] alfred: free globals. Fixes memory leak Nils Schneider
2013-09-09 15:08 ` Simon Wunderlich [this message]
2013-09-09 23:16 ` Linus Lüssing
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130909150831.GA11737@pandem0nium \
--to=simon.wunderlich@s2003.tu-chemnitz.de \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox