fix coverity Defect Type: Memory - Resource Leaks - CID 11975 - 12053
Created attachment 435644 [details] 0001-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435645 [details] 0002-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435646 [details] 0003-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435647 [details] 0004-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435648 [details] 0005-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435649 [details] 0006-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435650 [details] 0007-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435651 [details] 0008-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435652 [details] 0009-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435653 [details] 0010-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435654 [details] 0011-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435655 [details] 0012-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435656 [details] 0013-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435657 [details] 0014-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435658 [details] 0015-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435660 [details] 0016-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435661 [details] 0017-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435662 [details] 0018-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435663 [details] 0019-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435664 [details] 0020-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435665 [details] 0021-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435666 [details] 0022-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435667 [details] 0023-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435668 [details] 0024-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435669 [details] 0025-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435670 [details] 0026-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435671 [details] 0027-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435672 [details] 0028-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435673 [details] 0029-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435674 [details] 0030-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435675 [details] 0031-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435677 [details] 0032-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435678 [details] 0033-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435679 [details] 0034-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435680 [details] 0035-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Created attachment 435681 [details] 0036-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Comment on attachment 435644 [details] 0001-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=11976&streamDefectId=12162&defectInstanceId=14031&fileInstanceId=49207
Comment on attachment 435645 [details] 0002-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=11978&streamDefectId=12164&defectInstanceId=14033&fileInstanceId=48996
Comment on attachment 435646 [details] 0003-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=11980&streamDefectId=12166&defectInstanceId=14035&fileInstanceId=49042
Comment on attachment 435647 [details] 0004-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=11982&streamDefectId=12168&defectInstanceId=14037&fileInstanceId=49064
Comment on attachment 435648 [details] 0005-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=11983&streamDefectId=12169&defectInstanceId=14038&fileInstanceId=49064
Comment on attachment 435649 [details] 0006-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=11984&streamDefectId=12170&defectInstanceId=14039&fileInstanceId=49046
Comment on attachment 435650 [details] 0007-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=11986&streamDefectId=12172&defectInstanceId=14041&fileInstanceId=49042
Comment on attachment 435651 [details] 0008-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=11991&streamDefectId=12177&defectInstanceId=14046&fileInstanceId=49276 3652 done: 3653 if (hostport) slapi_ch_free_string(&hostport); 3654 if (ludp) ldap_free_urldesc( ludp ); ==> 3652 done: 3653 slapi_ch_free_string(&hostport); 3654 ldap_free_urldesc( ludp );
Comment on attachment 435652 [details] 0009-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=11994&streamDefectId=12180&defectInstanceId=14049&fileInstanceId=49271
Comment on attachment 435653 [details] 0010-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=11995&streamDefectId=12181&defectInstanceId=14050&fileInstanceId=48985
Comment on attachment 435654 [details] 0011-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=11996&streamDefectId=12182&defectInstanceId=14051&fileInstanceId=48985
Comment on attachment 435655 [details] 0012-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=11997&streamDefectId=12183&defectInstanceId=14052&fileInstanceId=48985
Comment on attachment 435656 [details] 0013-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=11997&streamDefectId=12183&defectInstanceId=14052&fileInstanceId=48985
Comment on attachment 435657 [details] 0014-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=11999&streamDefectId=12185&defectInstanceId=14054&fileInstanceId=49370 slapi_sdn_free calls slapi_sdn_done internally. We don't need the line 583. 583 slapi_sdn_done(suffix); 584 slapi_sdn_free(&suffix);
Comment on attachment 435658 [details] 0015-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12000&streamDefectId=12186&defectInstanceId=14055&fileInstanceId=49058
Comment on attachment 435660 [details] 0016-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12001&streamDefectId=12187&defectInstanceId=14058&fileInstanceId=49125 No need to do NULL checks fro slapi_ch_calloc: /* Make a service provider handle */ new_sp = (vattr_sp*)slapi_ch_calloc(1,sizeof(vattr_sp)); if (NULL == new_sp) { slapd_nasty(sourcefile,7,0); - return ENOMEM; + rc = ENOMEM; + goto error; } ==> /* Make a service provider handle */ new_sp = (vattr_sp*)slapi_ch_calloc(1,sizeof(vattr_sp)); return_to_caller = (vattr_sp_handle*)slapi_ch_calloc(1,sizeof(vattr_sp_handle)); if (NULL == return_to_caller) { slapd_nasty(sourcefile,8,0); - return ENOMEM; + rc = ENOMEM; + goto error; } ==> return_to_caller = (vattr_sp_handle*)slapi_ch_calloc(1,sizeof(vattr_sp_handle)); /* Make a handle for the list */ list_handle = (vattr_sp_handle*)slapi_ch_calloc(1, sizeof (vattr_sp_handle)); if (NULL == list_handle) { - return ENOMEM; + rc = ENOMEM; + goto error; } ==> /* Make a handle for the list */ list_handle = (vattr_sp_handle*)slapi_ch_calloc(1, sizeof (vattr_sp_handle)); That being said, we don't need this... + +error: + slapi_ch_free((void**)&new_sp); + return rc;
Comment on attachment 435661 [details] 0017-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch https://bugzilla.redhat.com/show_bug.cgi?id=619122#c53
Comment on attachment 435662 [details] 0018-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12003&streamDefectId=12189&defectInstanceId=14060&fileInstanceId=49421
Comment on attachment 435663 [details] 0019-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12005&streamDefectId=12191&defectInstanceId=14062&fileInstanceId=49603
Comment on attachment 435664 [details] 0020-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12006&streamDefectId=12192&defectInstanceId=14063&fileInstanceId=49603
Comment on attachment 435665 [details] 0021-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12008&streamDefectId=12194&defectInstanceId=14065&fileInstanceId=49603
Comment on attachment 435666 [details] 0022-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12011&streamDefectId=12197&defectInstanceId=14068&fileInstanceId=49449
Comment on attachment 435667 [details] 0023-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12015&streamDefectId=12201&defectInstanceId=14076&fileInstanceId=49476
Comment on attachment 435668 [details] 0024-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12026&streamDefectId=12212&defectInstanceId=14090&fileInstanceId=49518
Comment on attachment 435669 [details] 0025-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12027&streamDefectId=12213&defectInstanceId=14091&fileInstanceId=49539
Comment on attachment 435670 [details] 0026-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12028&streamDefectId=12214&defectInstanceId=14092&fileInstanceId=49524
Comment on attachment 435671 [details] 0027-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12029&streamDefectId=12215&defectInstanceId=14093&fileInstanceId=49518
Comment on attachment 435672 [details] 0028-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12033&streamDefectId=12219&defectInstanceId=14097&fileInstanceId=49525
Comment on attachment 435673 [details] 0029-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12035&streamDefectId=12221&defectInstanceId=14099&fileInstanceId=49526
Comment on attachment 435674 [details] 0030-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12036&streamDefectId=12222&defectInstanceId=14100&fileInstanceId=49526
Comment on attachment 435675 [details] 0031-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12037&streamDefectId=12223&defectInstanceId=14101&fileInstanceId=48976
Comment on attachment 435677 [details] 0032-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12038&streamDefectId=12224&defectInstanceId=14102&fileInstanceId=49536
Comment on attachment 435678 [details] 0033-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12044&streamDefectId=12230&defectInstanceId=14113&fileInstanceId=49524
Comment on attachment 435679 [details] 0034-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12048&streamDefectId=12234&defectInstanceId=14119&fileInstanceId=49532
Comment on attachment 435680 [details] 0035-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12049&streamDefectId=12235&defectInstanceId=14120&fileInstanceId=49532
Comment on attachment 435681 [details] 0036-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12051&streamDefectId=12237&defectInstanceId=14122&fileInstanceId=49497
Created attachment 439731 [details] 0008a-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch The patch has been modified to remove unnecessary NULL checking.
Created attachment 439732 [details] 0014a-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch The patch has been modified to remove unnecessary slapi_sdn_done() invocation.
Created attachment 439733 [details] 0016a-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch The patch has been modified to remove unnecessary NULL checking.
Created attachment 439740 [details] 0037-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch
Comment on attachment 439731 [details] 0008a-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=11991&streamDefectId=12177&defectInstanceId=14046&fileInstanceId=49276
Comment on attachment 439732 [details] 0014a-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=11999&streamDefectId=12185&defectInstanceId=14054&fileInstanceId=49370
Comment on attachment 439733 [details] 0016a-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030#mergedDefectId=12001&streamDefectId=12187&defectInstanceId=14058&fileInstanceId=49125
Comment on attachment 439740 [details] 0037-Bug-619122-fix-coverify-Defect-Type-Resource-leaks-i.patch http://10.16.47.145:8080/sourcebrowser.htm?projectId=10030&mergedDefectIds=11991#mergedDefectId=12025&streamDefectId=12211&defectInstanceId=14089&fileInstanceId=49515
On behalf of Endi (edewata), pushed to master. $ git merge endi Updating 5d578b8..92ee0f5 Fast-forward ldap/servers/plugins/acl/acl_ext.c | 20 +++++--- ldap/servers/plugins/acl/acllas.c | 47 ++++++++++--------- ldap/servers/plugins/chainingdb/cb_instance.c | 5 +- ldap/servers/plugins/cos/cos_cache.c | 2 +- ldap/servers/plugins/dna/dna.c | 6 ++- ldap/servers/plugins/passthru/ptconfig.c | 41 ++++++++++++----- ldap/servers/plugins/replication/cl5_api.c | 21 +++++--- .../servers/plugins/replication/repl5_connection.c | 26 +++++------ ldap/servers/plugins/replication/repl5_protocol.c | 8 ++- .../plugins/replication/repl5_protocol_util.c | 2 +- ldap/servers/plugins/replication/repl5_replica.c | 2 + ldap/servers/plugins/replication/repl5_ruv.c | 18 ++----- .../plugins/replication/repl5_tot_protocol.c | 7 +++- ldap/servers/plugins/replication/repl_compare.c | 1 + ldap/servers/plugins/replication/urp.c | 1 + .../plugins/replication/windows_connection.c | 1 + ldap/servers/slapd/csngen.c | 2 + ldap/servers/slapd/entry.c | 31 +++++++++++-- ldap/servers/slapd/factory.c | 1 + ldap/servers/slapd/log.c | 2 + ldap/servers/slapd/mapping_tree.c | 2 +- ldap/servers/slapd/plugin.c | 2 + ldap/servers/slapd/pw.c | 4 +- ldap/servers/slapd/vattr.c | 17 ++----- lib/libaccess/oneeval.cpp | 2 + 25 files changed, 165 insertions(+), 106 deletions(-) $ git push Counting objects: 275, done. Delta compression using up to 4 threads. Compressing objects: 100% (237/237), done. Writing objects: 100% (237/237), 23.44 KiB, done. Total 237 (delta 200), reused 0 (delta 0) To ssh://git.fedorahosted.org/git/389/ds.git 5d578b8..92ee0f5 master -> master