|
From: <ai...@us...> - 2013-10-21 01:04:08
|
Revision: 12613
http://sourceforge.net/p/plplot/code/12613
Author: airwin
Date: 2013-10-21 01:04:03 +0000 (Mon, 21 Oct 2013)
Log Message:
-----------
For Python typemap for char *legline[4] get rid of uninitialized
variable for the fail return path.
Modified Paths:
--------------
trunk/bindings/python/plplotcmodule.i
Modified: trunk/bindings/python/plplotcmodule.i
===================================================================
--- trunk/bindings/python/plplotcmodule.i 2013-10-20 04:41:07 UTC (rev 12612)
+++ trunk/bindings/python/plplotcmodule.i 2013-10-21 01:04:03 UTC (rev 12613)
@@ -1456,7 +1456,8 @@
// this typemap takes a sequence of strings and converts them for plstripc
// also checks that previous Arrays were of length 4
//
-%typemap( in ) const char *legline[4] {
+%typemap( in ) const char *legline[4] ( char** tmp = NULL )
+{
int i;
if ( !PySequence_Check( $input ) || PySequence_Size( $input ) != 4 )
{
@@ -1468,19 +1469,21 @@
PyErr_SetString( PyExc_ValueError, "colline and styline args must be length 4." );
return NULL;
}
- $1 = malloc( sizeof ( char* ) * 4 );
+ tmp = (char **) malloc( sizeof ( char* ) * 4 );
+ if ( tmp == NULL ) return NULL;
+ $1 = tmp;
for ( i = 0; i < 4; i++ )
{
$1[i] = PyString_AsString( PySequence_Fast_GET_ITEM( $input, i ) );
if ( $1[i] == NULL )
{
- free( $1 );
+ free( tmp );
return NULL;
}
}
}
%typemap( freearg ) const char *legline[4] {
- free( $1 );
+ free( tmp$argnum );
}
// End of all code associated with special call-back functions.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|