[PATCH 3/7] torture: Don't segfault in smb2.session on error.

Jeremy Allison jra at samba.org
Tue Jul 2 14:54:44 MDT 2013


On Tue, Jul 02, 2013 at 10:42:06PM +0200, Andreas Schneider wrote:
> On Tuesday 02 July 2013 12:26:59 Jeremy Allison wrote:
> > 
> > FYI. Most of these come from failing to initialize auto
> > variables on declaration.
> 
> auto variables?

I'm showing my age :-).

http://stackoverflow.com/questions/9911821/variable-auto-in-c

I reemmber when adding "auto" to a declaration could fix
compiler bugs :-).

> I think if you have a variable is which passed by reference to a function and 
> is an out (result) variable it should be initialized by default. Especially if 
> you use a destructor (goto done).

*ALL* stack based simple variables (and even some
structs) should have initializers IMHO.

We have had many, many bugs because of this.

Jeremy.


More information about the samba-technical mailing list