Memory leaks

Jeremy Allison jra at samba.org
Wed Jun 20 23:23:52 GMT 2007


On Wed, Jun 20, 2007 at 11:26:53AM +0900, Atsushi Nakabayashi wrote:
> Hi, samba-tech,
> 
> I have found a memory leak in the error route of the samba-3.0.24.
> 
> --- source/nmbd/nmbd_winsserver.c
> 2327         /* We will do the writing in a child process to ensure 
> that the parent doesn't block while this is done */
> 2328         if (background) {
> 2329                 CatchChild();
> 2330                 if (sys_fork()) {
> 2331                         return;
> 2332                 }
> 2333                 if (tdb_reopen(wins_tdb)) {
> 2334                         DEBUG(0,("wins_write_database: tdb_reopen 
> failed. Error was %s\n",
> 2335                                 strerror(errno)));
> 2336                         return;
> 2337                 }
> 
> The child process is not released, when the tdb_reopen function returns 
> false(-1).
> 

> diff -uNrp samba-3.0.24.org/source/nmbd/nmbd_winsserver.c samba-3.0.24/source/nmbd/nmbd_winsserver.c
> --- samba-3.0.24.org/source/nmbd/nmbd_winsserver.c	2007-06-19 23:38:38.000000000 +0900
> +++ samba-3.0.24/source/nmbd/nmbd_winsserver.c	2007-06-19 23:39:05.000000000 +0900
> @@ -2333,6 +2333,7 @@ void wins_write_database(time_t t, BOOL 
>  		if (tdb_reopen(wins_tdb)) {
>  			DEBUG(0,("wins_write_database: tdb_reopen failed. Error was %s\n",
>  				strerror(errno)));
> +				_exit(0);
>  			return;
>  		}
>  	}

Perfectly correct - applied - thanks !

Jeremy.


More information about the samba-technical mailing list