[Monetdb-developers] [Monetdb-checkins] MonetDB5/src/modules/mal mal_mapi.mx, Nov2009, 1.37.2.3, 1.37.2.4

Romulo Goncalves R.A.Goncalves at cwi.nl
Wed Nov 11 15:56:15 CET 2009


Hello,

One remark for a broken test in SQL.

Fabian wrote:
> Update of /cvsroot/monetdb/MonetDB5/src/modules/mal
> In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv27989
> 
> Modified Files:
>       Tag: Nov2009
> 	mal_mapi.mx 
> Log Message:
> Free resources allocated for Mapi struct before returning.  Found by Coverity.  (I have no clue how to update this so it is recorded as handled in the Coverity webpage, someone please fill me in.)
> 
> Index: mal_mapi.mx
> ===================================================================
> RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/mal_mapi.mx,v
> retrieving revision 1.37.2.3
> retrieving revision 1.37.2.4
> diff -u -d -r1.37.2.3 -r1.37.2.4
> --- mal_mapi.mx	30 Oct 2009 18:48:31 -0000	1.37.2.3
> +++ mal_mapi.mx	3 Nov 2009 18:27:14 -0000	1.37.2.4
> @@ -407,7 +407,7 @@
>  		bstream *bs;
>  		int len = 0;
>  
> -		if ( buf == NULL){
> +		if (buf == NULL){
>  			GDKsyserror("SERVERlisten:"MAL_MALLOC_FAIL);
>  			return;
>  		}
> @@ -922,6 +922,7 @@
>  		if (err[0] == '!')
>  			err = err + 1;
>  		SERVERsessions[i].c = NULL;
> +		mapi_destroy(mid);
You are freeing here mid, but err is dependent of it.
Because the complete if clause is like this:

if (mapi_error(mid)) {
                 str err = mapi_error_str(mid);
                 if (err == NULL)
                         err = "(no reason given)";
                 if (err[0] == '!')
                         err = err + 1;
                 SERVERsessions[i].c = NULL;
                 mapi_destroy(mid);
                 throw(IO, "mapi.connect", "Could not connect: %s", err);
         }

and mapi_error returns:

926			str err = mapi_error_str(mid);
(gdb) s
mapi_error_str (mid=0x1277af0)
     at /ufs/goncalve/MonetDB/stable/clients/src/mapilib/Mapi.mx:1352
1352		assert(mid);
(gdb) n
1353		return mid->errorstr;
(gdb)
1354	}

This is the reason why connection is broken and gives the following error message:
ERROR = !IOException:mapi.connect:Could not connect: `Ú¶08

instead of:
ERROR = !IOException:mapi.connect:Could not connect: Setup connection failed

Correct if I am wrong...
Ro


>  		throw(IO, "mapi.connect", "Could not connect: %s", err);
>  	}
>  
> 
> 
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay 
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Monetdb-checkins mailing list
> Monetdb-checkins at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/monetdb-checkins




More information about the developers-list mailing list