diff options
| author | Endi S. Dewata <edewata@redhat.com> | 2010-07-26 13:27:22 -0500 |
|---|---|---|
| committer | Noriko Hosoi <nhosoi@redhat.com> | 2010-08-19 17:01:05 -0700 |
| commit | c9ab0b942a5428e00460ce33c97ff08d0bfb255f (patch) | |
| tree | 077f62416200896fa4659b4221f6d43bf3972041 | |
| parent | 2ab53b6abef228c3e656c4e9c13074c2e20939b3 (diff) | |
Bug 617630 - fix coverify Defect Type: Resource leaks issues CID 12052 - 12093
https://bugzilla.redhat.com/show_bug.cgi?id=617630
Resolves: bug 617630
Bug description: fix coverify Defect Type: Resource leaks issues CID 12083.
description: plugin_enabled() has been modified to use slapi_entry_attr_has_syntax_value() to avoid resource leaks.
| -rw-r--r-- | ldap/servers/slapd/plugin.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/ldap/servers/slapd/plugin.c b/ldap/servers/slapd/plugin.c index e31c846e..a64fcd67 100644 --- a/ldap/servers/slapd/plugin.c +++ b/ldap/servers/slapd/plugin.c @@ -2979,7 +2979,7 @@ plugin_enabled(const char *plugin_name, void *identity) { Slapi_PBlock *search_pb = NULL; Slapi_Entry **entries = NULL, **ep = NULL; - char *on_off = NULL; + Slapi_Value *on_off = slapi_value_new_string("on"); char *filter = NULL; int rc = 0; /* disabled, by default */ @@ -2995,15 +2995,14 @@ plugin_enabled(const char *plugin_name, void *identity) slapi_pblock_get(search_pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, &entries); for (ep = entries; ep && *ep; ep++) { - on_off = slapi_entry_attr_get_charptr(*ep, "nsslapd-pluginEnabled"); - if (on_off && (0 == strcasecmp(on_off, "on"))) { + if (slapi_entry_attr_has_syntax_value(*ep, "nsslapd-pluginEnabled", on_off)) { rc = 1; /* plugin is on */ goto bail; } } bail: - slapi_ch_free_string(&on_off); + slapi_value_free(&on_off); slapi_free_search_results_internal(search_pb); slapi_pblock_destroy(search_pb); slapi_ch_free_string(&filter); |
