@@ -226,12 +226,13 @@ int
226
226
Remote_name__set__ (Remote * self , PyObject * py_name )
227
227
{
228
228
int err ;
229
- char * name ;
229
+ const char * name ;
230
+ PyObject * tname ;
230
231
231
- name = py_str_to_c_str ( py_name , NULL );
232
+ name = py_str_borrow_c_str ( & tname , py_name , NULL );
232
233
if (name != NULL ) {
233
234
err = git_remote_rename (self -> remote , name , NULL , NULL );
234
- free ( name );
235
+ Py_DECREF ( tname );
235
236
236
237
if (err == GIT_OK )
237
238
return 0 ;
@@ -404,12 +405,13 @@ int
404
405
Remote_url__set__ (Remote * self , PyObject * py_url )
405
406
{
406
407
int err ;
407
- char * url = NULL ;
408
+ const char * url = NULL ;
409
+ PyObject * turl ;
408
410
409
- url = py_str_to_c_str ( py_url , NULL );
411
+ url = py_str_borrow_c_str ( & turl , py_url , NULL );
410
412
if (url != NULL ) {
411
413
err = git_remote_set_url (self -> remote , url );
412
- free ( url );
414
+ Py_DECREF ( turl );
413
415
414
416
if (err == GIT_OK )
415
417
return 0 ;
@@ -440,12 +442,13 @@ int
440
442
Remote_push_url__set__ (Remote * self , PyObject * py_url )
441
443
{
442
444
int err ;
443
- char * url = NULL ;
445
+ const char * url = NULL ;
446
+ PyObject * turl ;
444
447
445
- url = py_str_to_c_str ( py_url , NULL );
448
+ url = py_str_borrow_c_str ( & turl , py_url , NULL );
446
449
if (url != NULL ) {
447
450
err = git_remote_set_pushurl (self -> remote , url );
448
- free ( url );
451
+ Py_DECREF ( turl );
449
452
450
453
if (err == GIT_OK )
451
454
return 0 ;
0 commit comments