Update of /cvsroot/monetdb/pathfinder/modules/pftijah
In directory 
sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv28299/modules/pftijah

Modified Files:
      Tag: XQFT
        serialize_pftijah.mx 
Log Message:
propagated changes of Friday Dec 04 2009
from the development trunk to the XQFT branch

  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2009/12/04 - sjoerd: modules/pftijah/serialize_pftijah.mx,1.82
  propagated changes of Friday Dec 04 2009
  from the Nov2009 branch to the development trunk
  
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    2009/12/04 - sjoerd: modules/pftijah/serialize_pftijah.mx,1.80.2.2
    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.81
retrieving revision 1.81.2.1
diff -u -d -r1.81 -r1.81.2.1
--- serialize_pftijah.mx        8 Oct 2009 09:44:06 -0000       1.81
+++ serialize_pftijah.mx        4 Dec 2009 14:44:55 -0000       1.81.2.1
@@ -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

Reply via email to