[Monetdb-developers] [Monetdb-checkins] MonetDB5/src/modules/mal mal_io.mx, Nov2009, 1.48.6.2, 1.48.6.3 mal_mapi.mx, Nov2009, 1.37.2.6, 1.37.2.7 recycle.mx, Nov2009, 1.66.2.1, 1.66.2.2

Stefan Manegold Stefan.Manegold at cwi.nl
Fri Nov 6 16:37:24 CET 2009


On Fri, Nov 06, 2009 at 03:17:16PM +0000, Martin Kersten wrote:
> Update of /cvsroot/monetdb/MonetDB5/src/modules/mal
> In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv8920
> 
> Modified Files:
>       Tag: Nov2009
> 	mal_io.mx mal_mapi.mx recycle.mx 
> Log Message:
> A few Coverity changes.
> 
> 
> Index: mal_mapi.mx
> ===================================================================
> RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/mal_mapi.mx,v
> retrieving revision 1.37.2.6
> retrieving revision 1.37.2.7
> diff -u -d -r1.37.2.6 -r1.37.2.7
> --- mal_mapi.mx	3 Nov 2009 20:15:01 -0000	1.37.2.6
> +++ mal_mapi.mx	6 Nov 2009 15:17:13 -0000	1.37.2.7
> @@ -402,8 +402,8 @@
>  		char *buf = (char *) GDKmalloc(BLOCK + 1);
>  		char *challenge;
>  		char *algos;
> -		stream *fdin = block_stream(in);
> -		stream *fdout = block_stream(out);
> +		stream *fdin;
> +		stream *fdout;
                        ^^^^^
>  		bstream *bs;
>  		int len = 0;
>  
> @@ -411,10 +411,12 @@
>  			GDKsyserror("SERVERlisten:"MAL_MALLOC_FAIL);
>  			return;
>  		}
> +		fdin = block_stream(in);
>  		if (!fdin || !fdout) {
                              ^^^^^
without even running a compiler (let alone coverity):

"fdout is used without/before being initialized"

Stefan

>  			GDKsyserror("SERVERlisten:fdin or fdout problems");
>  			return;
>  		}
> +		fdout = block_stream(out);
                ^^^^^
>  
>  		assert(buf);
>  
> 
> Index: mal_io.mx
> ===================================================================
> RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/mal_io.mx,v
> retrieving revision 1.48.6.2
> retrieving revision 1.48.6.3
> diff -u -d -r1.48.6.2 -r1.48.6.3
> --- mal_io.mx	30 Oct 2009 08:19:02 -0000	1.48.6.2
> +++ mal_io.mx	6 Nov 2009 15:17:13 -0000	1.48.6.3
> @@ -779,8 +779,12 @@
>  str
>  IOdatafile(str *ret, str *fnme){
>  	stream *s = open_rstream(*fnme);
> -	if (s == NULL || stream_errnr(s)) {
> -		*ret = 0;
> +	*ret = 0;
> +	if (s == NULL )
> +		throw(MAL, "io.export", RUNTIME_FILE_NOT_FOUND ":%s", fnme);
> +	
> +	if (stream_errnr(s)) {
> +		stream_close(s);
>  		throw(MAL, "io.export", RUNTIME_FILE_NOT_FOUND ":%s", fnme);
>  	}
>  	*ret= GDKstrdup(*fnme);
> @@ -793,13 +797,20 @@
>  IOexport(bit *ret, int *bid, str *fnme)
>  {
>  	BAT *b;
> -	stream *s = open_wastream(*fnme);
> +	stream *s;
>  
> -	if ((b = BATdescriptor(*bid)) == NULL) {
> +	*ret = FALSE;
> +	if ((b = BATdescriptor(*bid)) == NULL) 
>  		throw(MAL, "io.export", RUNTIME_OBJECT_MISSING);
> +	
> +	s = open_wastream(*fnme);
> +	if (s == NULL ){
> +		BBPunfix(b->batCacheid);
> +		throw(MAL, "io.export", RUNTIME_FILE_NOT_FOUND ":%s", fnme);
>  	}
> -	if (s == NULL || stream_errnr(s)) {
> -		*ret = FALSE;
> +	if (stream_errnr(s)) {
> +		stream_close(s);
> +		BBPunfix(b->batCacheid);
>  		throw(MAL, "io.export", RUNTIME_FILE_NOT_FOUND ":%s", fnme);
>  	}
>  	BATprintf(s, b);
> @@ -822,13 +833,11 @@
>  	int (*hconvert) (str, int *, ptr *), (*tconvert) (str, int *, ptr *);
>  	size_t bufsize = 2048;	/* NIELS:tmp change used to be 1024 */
>  	char *base, *cur, *end;
> -	char *buf = (char *) GDKmalloc(bufsize);
> +	char *buf;
>  	ptr h = 0, t = 0;
>  	int lh = 0, lt = 0;
>  	FILE *fp = fopen(*fnme, "r");
>  
> -	if ( buf == NULL)
> -		throw(MAL,"io.import",MAL_MALLOC_FAIL);
>  	if ((b = BATdescriptor(*bid)) == NULL) 
>  		throw(MAL, "io.import", RUNTIME_OBJECT_MISSING);
>  
> @@ -844,6 +853,12 @@
>  		int fn;
>  		struct stat st;
>  
> +		buf = (char *) GDKmalloc(bufsize);
> +		if ( buf == NULL) {
> +			BBPunfix(b->batCacheid);
> +			throw(MAL,"io.import",MAL_MALLOC_FAIL);
> +		}
> +
>  		if ((fn = fileno(fp)) <= 0) {
>  			BBPunfix(b->batCacheid);
>  			throw(MAL, "io.import", OPERATION_FAILED " fileno()");
> 
> Index: recycle.mx
> ===================================================================
> RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/recycle.mx,v
> retrieving revision 1.66.2.1
> retrieving revision 1.66.2.2
> diff -u -d -r1.66.2.1 -r1.66.2.2
> --- recycle.mx	25 Oct 2009 10:02:32 -0000	1.66.2.1
> +++ recycle.mx	6 Nov 2009 15:17:13 -0000	1.66.2.2
> @@ -272,8 +272,11 @@
>  	if (pci->argc >1){
>  		fname = * (str*) getArgReference(stk, pci,1);
>  		s = open_wastream(fname);
> -		if (s == NULL || stream_errnr(s))
> +		if (s == NULL || stream_errnr(s)) {
> +			if ( s )
> +				stream_close(s);
>  			throw(MAL,"recycle", RUNTIME_FILE_NOT_FOUND "%s", fname);
> +		}
>  	}
>  	RECYCLEdump(s);
>  	if( s != cntxt->fdout)
> 
> 
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Monetdb-checkins mailing list
> Monetdb-checkins at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/monetdb-checkins
> 
> 

-- 
| Dr. Stefan Manegold | mailto:Stefan.Manegold at cwi.nl |
| CWI,  P.O.Box 94079 | http://www.cwi.nl/~manegold/  |
| 1090 GB Amsterdam   | Tel.: +31 (20) 592-4212       |
| The Netherlands     | Fax : +31 (20) 592-4312       |




More information about the developers-list mailing list