Re: PATCH: anti memleak part 1



On 2001.10.18 20:21 Brian Stafford wrote:
> On 2001.10.18 16:53:56 +0100 Peter Bloomfield wrote:
> 
> > > diff -ruN balsa-cvs/src/balsa-app.c balsa/src/balsa-app.c
> > > --- balsa-cvs/src/balsa-app.c	Thu Oct 18 16:38:15 2001
> > > +++ balsa/src/balsa-app.c	Thu Oct 18 16:51:17 2001
> > ...
> > > @@ -188,14 +186,14 @@
> > >  static int
> > >  tlsinteract (char *buf, int buflen, int rwflag, void *arg)
> > >  {
> > > -  char *pw;
> > >    int len;
> > > 
> > > -  pw = balsa_app.smtp_certificate_passphrase;
> > > -  len = strlen (pw);
> > > +  len = strlen (balsa_app.smtp_certificate_passphrase);
> > > +
> > >    if (len + 1 > buflen)
> > >      return 0;
> > > -  strcpy (buf, pw);
> > > +
> > > +  buf = balsa_app.smtp_certificate_passphrase;
> > >    return len;
> > >  }
> > >  #endif
> > 

[SNIPP]


> Not sure why I wrote the code like this.  Either I had a good reason
> that escapes me just now, or I copied and edited it from somewhere else!

I think the main reason was to avoid to type twice "balsa_app.smtp..." ;-)
That apart I think we can get rid of pw var.
Bye
Manu



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]