diff options
author | Endi S. Dewata <edewata@redhat.com> | 2010-07-30 01:25:39 -0500 |
---|---|---|
committer | Noriko Hosoi <nhosoi@redhat.com> | 2010-08-19 14:25:01 -0700 |
commit | b4fb0eae14911413612273c152cb935a6f8804b2 (patch) | |
tree | 37d86b7911bcc76c55e2c52363bc428277713f5c /ldap | |
parent | ad8d2dd8d82876c7856818ec278fc28f09cbf624 (diff) | |
download | ds-b4fb0eae14911413612273c152cb935a6f8804b2.tar.gz ds-b4fb0eae14911413612273c152cb935a6f8804b2.tar.xz ds-b4fb0eae14911413612273c152cb935a6f8804b2.zip |
Bug 619122 - fix coverify Defect Type: Resource leaks issues CID 11975 - 12053
https://bugzilla.redhat.com/show_bug.cgi?id=619122
Resolves: bug 619122
Bug description: fix coverify Defect Type: Resource leaks issues CID 12015.
description: The _cl5ReadRUV() has been modified to release vals before it returns.
Diffstat (limited to 'ldap')
-rw-r--r-- | ldap/servers/plugins/replication/cl5_api.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/ldap/servers/plugins/replication/cl5_api.c b/ldap/servers/plugins/replication/cl5_api.c index 8b79887c..ece4d273 100644 --- a/ldap/servers/plugins/replication/cl5_api.c +++ b/ldap/servers/plugins/replication/cl5_api.c @@ -4481,7 +4481,7 @@ static int _cl5ReadRUV (const char *replGen, Object *obj, PRBool purge) int rc; char csnStr [CSN_STRSIZE]; DBT key={0}, data={0}; - struct berval **vals; + struct berval **vals = NULL; CL5DBFile *file; char *pos; char *agmt_name; @@ -4510,7 +4510,7 @@ static int _cl5ReadRUV (const char *replGen, Object *obj, PRBool purge) rc = _cl5ReadBervals (&vals, &pos, data.size); slapi_ch_free (&(data.data)); if (rc != CL5_SUCCESS) - return rc; + goto done; if (purge) rc = ruv_init_from_bervals(vals, &file->purgeRUV); @@ -4523,26 +4523,31 @@ static int _cl5ReadRUV (const char *replGen, Object *obj, PRBool purge) "%s: _cl5ReadRUV: failed to initialize %s ruv; " "RUV error %d\n", agmt_name, purge? "purge" : "upper bound", rc); - return CL5_RUV_ERROR; + rc = CL5_RUV_ERROR; + goto done; } - ber_bvecfree(vals); - /* delete the entry; it is re-added when file is successfully closed */ file->db->del (file->db, NULL, &key, DEFAULT_DB_OP_FLAGS); - return CL5_SUCCESS; + rc = CL5_SUCCESS; + goto done; case DB_NOTFOUND: /* RUV is lost - need to construct */ rc = _cl5ConstructRUV (replGen, obj, purge); - return rc; + goto done; default: slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name_cl, "%s: _cl5ReadRUV: failed to get purge RUV; " "db error - %d %s\n", agmt_name, rc, db_strerror(rc)); - return CL5_DB_ERROR; + rc = CL5_DB_ERROR; + goto done; } + +done: + ber_bvecfree(vals); + return rc; } static int _cl5WriteRUV (CL5DBFile *file, PRBool purge) |