[Python-checkins] python/dist/src/Modules _localemodule.c,2.39,2.40
mhammond@users.sourceforge.net
mhammond@users.sourceforge.net
Thu, 24 Jul 2003 07:15:09 -0700
Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv18505
Modified Files:
_localemodule.c
Log Message:
Fix [ 776721 ] locale.setlocale() leaks
Our saved locale was not being freed. Also check correct variable for
NULL.
Index: _localemodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_localemodule.c,v
retrieving revision 2.39
retrieving revision 2.40
diff -C2 -d -r2.39 -r2.40
*** _localemodule.c 5 Mar 2003 15:13:45 -0000 2.39
--- _localemodule.c 24 Jul 2003 14:15:07 -0000 2.40
***************
*** 182,186 ****
}
result_object = PyString_FromString(result);
! if (!result)
return NULL;
/* record changes to LC_NUMERIC */
--- 182,186 ----
}
result_object = PyString_FromString(result);
! if (!result_object)
return NULL;
/* record changes to LC_NUMERIC */
***************
*** 200,203 ****
--- 200,205 ----
Py_XDECREF(decimal_point);
decimal_point = PyString_FromString(lc->decimal_point);
+ if (saved_numeric)
+ free(saved_numeric);
saved_numeric = strdup(locale);
/* restore to "C" */