Revision: 435
          http://rpy.svn.sourceforge.net/rpy/?rev=435&view=rev
Author:   lgautier
Date:     2008-03-15 02:02:15 -0700 (Sat, 15 Mar 2008)

Log Message:
-----------
Fixed potential use of uninitialized tmp_obj

Modified Paths:
--------------
    trunk/sandbox/rpy_nextgen/rpy/rinterface/rinterface.c

Modified: trunk/sandbox/rpy_nextgen/rpy/rinterface/rinterface.c
===================================================================
--- trunk/sandbox/rpy_nextgen/rpy/rinterface/rinterface.c       2008-03-15 
08:41:21 UTC (rev 434)
+++ trunk/sandbox/rpy_nextgen/rpy/rinterface/rinterface.c       2008-03-15 
09:02:15 UTC (rev 435)
@@ -470,12 +470,15 @@
     tmp_obj = PyTuple_GetItem(args, arg_i);
     is_SexpObject = PyObject_TypeCheck(tmp_obj, &Sexp_Type);
     if (! is_SexpObject) {
-      PyErr_Format(PyExc_ValueError, "All parameters must be of type 
Sexp_Type.");
+      PyErr_Format(PyExc_ValueError, 
+                  "All parameters must be of type Sexp_Type.");
+      Py_DECREF(tmp_obj);
       goto fail;
     }
     tmp_R = ((SexpObject *)tmp_obj)->sexp;
     if (! tmp_R) {
       PyErr_Format(PyExc_ValueError, "NULL SEXP.");
+      Py_DECREF(tmp_obj);
       goto fail;
     }
     SETCAR(c_R, tmp_R);
@@ -493,14 +496,14 @@
       tmp_obj = PySequence_GetItem(citems, arg_i);
       if (! tmp_obj) {
        PyErr_Format(PyExc_ValueError, "No un-named item %i !?", arg_i);
-       
+       Py_DECREF(tmp_obj);
        Py_XDECREF(citems);
        goto fail;
       }
       argName = PyTuple_GetItem(tmp_obj, 0);
       if (! PyString_Check(argName)) {
        PyErr_SetString(PyExc_TypeError, "keywords must be strings");
-
+       Py_DECREF(tmp_obj);
        Py_XDECREF(citems);
        goto fail;
       }
@@ -509,7 +512,7 @@
       if (! is_SexpObject) {
        PyErr_Format(PyExc_ValueError, 
                     "All named parameters must be of type Sexp_Type.");
-       
+       Py_DECREF(tmp_obj);     
        Py_XDECREF(citems);
        goto fail;
       }
@@ -517,7 +520,7 @@
       tmp_R = ((SexpObject *)argValue)->sexp;
       if (! tmp_R) {
        PyErr_Format(PyExc_ValueError, "NULL SEXP.");
-
+       Py_DECREF(tmp_obj);
        Py_XDECREF(citems);
        goto fail;
       }
@@ -548,7 +551,6 @@
   
  fail:
   printf("failed.\n");
-  Py_DECREF(tmp_obj);
   UNPROTECT(1);
   return NULL;
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to