Update of /cvsroot/monetdb/pathfinder/modules/pftijah
In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv25556
Modified Files:
Tag: Nov2009
serialize_pftijah.mx
Log Message:
First of all, we can use GDKstrdup instead of GDKmalloc/strcpy.
Second of all, we already know res != NULL (since it is dereferenced).
What's interesting is whether *res is NULL.
Found by Coverity.
Index: serialize_pftijah.mx
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/modules/pftijah/serialize_pftijah.mx,v
retrieving revision 1.80.2.1
retrieving revision 1.80.2.2
diff -u -d -r1.80.2.1 -r1.80.2.2
--- serialize_pftijah.mx 11 Nov 2009 15:07:22 -0000 1.80.2.1
+++ serialize_pftijah.mx 4 Dec 2009 14:22:48 -0000 1.80.2.2
@@ -1434,22 +1434,20 @@
*res = NULL;
} else {
//if (*res) GDKfree(*res);
- *res = GDKmalloc( strlen(stemmed)+1 );
- if ( !res ) {
+ *res = GDKstrdup( stemmed );
+ if ( !*res ) {
stream_printf(GDKout,"CMDtj_normalizeTerm: GDKmalloc()
failed.\n");
return GDK_FAIL;
}
- strcpy( *res, stemmed );
}
//if ( stemCtx->clear ) stemCtx->clear( stemCtx );
} else {
//if (*res) GDKfree(*res);
- *res = GDKmalloc( strlen(term)+1 );
- if ( !res ) {
+ *res = GDKstrdup( term );
+ if ( !*res ) {
stream_printf(GDKout,"CMDtj_normalizeTerm: GDKmalloc() failed.\n");
return GDK_FAIL;
}
- strcpy( *res, term );
}
return GDK_SUCCEED;
}
------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing.
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins