Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1491977

Re: [PATCH 4/5] ISDN-Gigaset: Release memory in gigaset_initcs() after an allocation failure

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject Re: [PATCH 4/5] ISDN-Gigaset: Release memory in gigaset_initcs() after an allocation failure
Date 2016-09-27 17:20 +0200
Message-ID <sm2kO-2EY-3@gated-at.bofh.it> (permalink)
References <qEuGl-43C-5@gated-at.bofh.it> <slGaB-5yk-1@gated-at.bofh.it> <slGki-5BO-17@gated-at.bofh.it> <slLtE-wZ-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


>> @@ -772,8 +775,9 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
>>  
>>  	gig_dbg(DEBUG_INIT, "cs initialized");
>>  	return cs;
>> -
>> -error:
>> +free_bcs:
>> +	kfree(cs->bcs);
>> +report_failure:
>>  	gig_dbg(DEBUG_INIT, "failed");
>>  	gigaset_freecs(cs);
> 
> gigaset_freecs() is not a function I look at for the fun of it. But
> still, in it we find:
> 
> 	case 0: /* error in basic setup */
> 		[...]
> 		kfree(cs->inbuf);
> 		kfree(cs->bcs);
> 
> As far as I can tell we will call those two kfree()'s if we jump to
> "error". So, contrary to your analysis, I don't think we leak cs->bcs.

You are right.

Thanks that you pointed this source code place out again.

I imagined that the exception handling implementation could be more direct
somehow for a while. But this function takes extra care for data synchronisation
by a mutex.

Now I recognise also that this proposed update step "4" was inappropriate.
I'm sorry for the confusion I introduced here.

Regards,
Markus

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/5] ISDN-Gigaset: Fine-tuning for three function  implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-26 17:40 +0200
  [PATCH 1/5] ISDN-Gigaset: Use kmalloc_array() in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-26 17:40 +0200
    Re: [PATCH 1/5] ISDN-Gigaset: Use kmalloc_array() in two functions Paul Bolle <pebolle@tiscali.nl> - 2016-09-28 13:40 +0200
      Re: [PATCH 1/5] ISDN-Gigaset: Use kmalloc_array() in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-28 18:50 +0200
        Re: [PATCH 1/5] ISDN-Gigaset: Use kmalloc_array() in two functions Paul Bolle <pebolle@tiscali.nl> - 2016-09-28 19:50 +0200
  [PATCH 2/5] ISDN-Gigaset: Improve another size determination in  gigaset_initcs() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-26 17:50 +0200
  [PATCH 4/5] ISDN-Gigaset: Release memory in gigaset_initcs() after an  allocation failure SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-26 17:50 +0200
    Re: [PATCH 4/5] ISDN-Gigaset: Release memory in gigaset_initcs()  after an allocation failure Paul Bolle <pebolle@tiscali.nl> - 2016-09-26 23:20 +0200
      Re: ISDN-Gigaset: Release memory in gigaset_initcs() after an  allocation failure SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-27 07:30 +0200
        Re: ISDN-Gigaset: Release memory in gigaset_initcs() after an  allocation failure Paul Bolle <pebolle@tiscali.nl> - 2016-09-27 10:50 +0200
          Re: ISDN-Gigaset: Release memory in gigaset_initcs() after an  allocation failure SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-27 11:40 +0200
            Re: ISDN-Gigaset: Release memory in gigaset_initcs() after an  allocation failure Paul Bolle <pebolle@tiscali.nl> - 2016-09-27 11:50 +0200
            Re: [Gigaset307x-common] ISDN-Gigaset: Release memory in  gigaset_initcs() after an allocation failure Tilman Schmidt <tilman@imap.cc> - 2016-09-27 12:30 +0200
              Re: [Gigaset307x-common] ISDN-Gigaset: Release memory in  gigaset_initcs() after an allocation failure SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-27 13:40 +0200
                Re: [Gigaset307x-common] ISDN-Gigaset: Release memory in  gigaset_initcs() after an allocation failure Tilman Schmidt <tilman@imap.cc> - 2016-09-27 14:10 +0200
                Re: [Gigaset307x-common] ISDN-Gigaset: Release memory in  gigaset_initcs() after an allocation failure isdn@linux-pingi.de - 2016-09-27 14:20 +0200
                Re: [Gigaset307x-common] ISDN-Gigaset: Release memory in  gigaset_initcs() after an allocation failure SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-27 15:00 +0200
                Re: [Gigaset307x-common] ISDN-Gigaset: Release memory in  gigaset_initcs() after an allocation failure Tilman Schmidt <tilman@imap.cc> - 2016-09-27 16:40 +0200
      Re: [PATCH 4/5] ISDN-Gigaset: Release memory in gigaset_initcs()  after an allocation failure Dan Carpenter <dan.carpenter@oracle.com> - 2016-09-27 09:40 +0200
      Re: [PATCH 4/5] ISDN-Gigaset: Release memory in gigaset_initcs()  after an allocation failure SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-27 17:20 +0200
    Re: [PATCH 4/5] ISDN-Gigaset: Release memory in gigaset_initcs()  after an allocation failure Dan Carpenter <dan.carpenter@oracle.com> - 2016-09-27 09:20 +0200
      Re: ISDN-Gigaset: Release memory in gigaset_initcs() after an  allocation failure SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-27 09:30 +0200
  [PATCH 3/5] ISDN-Gigaset: Delete an error message for a failed memory  allocation SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-26 17:50 +0200
    Re: [PATCH 3/5] ISDN-Gigaset: Delete an error message for a failed  memory allocation Tilman Schmidt <tilman@imap.cc> - 2016-09-27 13:00 +0200
      Re: [PATCH 3/5] ISDN-Gigaset: Delete an error message for a failed  memory allocation Paul Bolle <pebolle@tiscali.nl> - 2016-09-28 13:50 +0200
  [PATCH 5/5] ISDN-Gigaset: Enclose two expressions for the sizeof  operator by parentheses SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-26 17:50 +0200
    RE: [PATCH 5/5] ISDN-Gigaset: Enclose two expressions for the  sizeof operator by parentheses David Laight <David.Laight@ACULAB.COM> - 2016-09-26 18:10 +0200
      Re: [PATCH 5/5] ISDN-Gigaset: Enclose two expressions for the  sizeof operator by parentheses Joe Perches <joe@perches.com> - 2016-09-26 18:30 +0200
        Re: [PATCH 5/5] ISDN-Gigaset: Enclose two expressions for the sizeof  operator by parentheses SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-26 18:50 +0200
          Re: [PATCH 5/5] ISDN-Gigaset: Enclose two expressions for the sizeof  operator by parentheses Julia Lawall <julia.lawall@lip6.fr> - 2016-09-26 19:00 +0200
        [PATCH v2 5/5] ISDN-Gigaset: Enclose two expressions for the sizeof  operator by parentheses SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-26 19:50 +0200
          Re: [PATCH v2 5/5] ISDN-Gigaset: Enclose two expressions for the  sizeof operator by parentheses Paul Bolle <pebolle@tiscali.nl> - 2016-09-26 20:40 +0200
            Re: [PATCH v2 5/5] ISDN-Gigaset: Enclose two expressions for the  sizeof operator by parentheses SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-26 20:50 +0200
          Re: [PATCH v2 5/5] ISDN-Gigaset: Enclose two expressions for the  sizeof operator by parentheses David Miller <davem@davemloft.net> - 2016-09-27 02:20 +0200
            Re: [PATCH v2 5/5] ISDN-Gigaset: Enclose two expressions for the  sizeof operator by parentheses SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-27 07:40 +0200
    Re: [PATCH 5/5] ISDN-Gigaset: Enclose two expressions for the sizeof  operator by parentheses Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-09-26 19:40 +0200
      Re: ISDN-Gigaset: Enclose two expressions for the sizeof operator by  parentheses SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-26 20:10 +0200
        Re: ISDN-Gigaset: Enclose two expressions for the sizeof operator  by parentheses Paul Bolle <pebolle@tiscali.nl> - 2016-09-26 20:40 +0200
      Re: [PATCH 5/5] ISDN-Gigaset: Enclose two expressions for the sizeof  operator by parentheses Dan Carpenter <dan.carpenter@oracle.com> - 2016-09-27 09:10 +0200
        Re: [PATCH 5/5] ISDN-Gigaset: Enclose two expressions for the sizeof  operator by parentheses Dan Carpenter <dan.carpenter@oracle.com> - 2016-09-27 09:30 +0200
  Re: [PATCH 0/5] ISDN-Gigaset: Fine-tuning for three function  implementations Paul Bolle <pebolle@tiscali.nl> - 2016-09-26 22:40 +0200
    Re: ISDN-Gigaset: Fine-tuning for three function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-27 07:20 +0200
  Re: [PATCH 0/5] ISDN-Gigaset: Fine-tuning for three function  implementations Paul Bolle <pebolle@tiscali.nl> - 2016-09-28 14:00 +0200
    Re: ISDN-Gigaset: Fine-tuning for three function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-28 19:00 +0200
      Re: ISDN-Gigaset: Fine-tuning for three function implementations Paul Bolle <pebolle@tiscali.nl> - 2016-09-28 20:00 +0200

csiph-web