diff mbox

[05/12] libnsdb: don't leak upon LDAP parse failure

Message ID 20111213225141.15402.32056.stgit@degas.1015granger.net
State Accepted
Headers show

Commit Message

Chuck Lever Dec. 13, 2011, 10:51 p.m. UTC
From: Jim Meyering <meyering@redhat.com>

* src/libnsdb/fileserver.c (nsdb_resolve_fsn_parse_entry): When we
fail to parse an LDAP entry, free just-allocated new->fl_dn and new.
Spotted by coverity.

Introduced by commit 0520ee72: "Initial commit," (March 29, 2011).

Signed-off-by: Jim Meyering <meyering@redhat.com>
---

 src/libnsdb/fileserver.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/src/libnsdb/fileserver.c b/src/libnsdb/fileserver.c
index a7631e8..b22d83f 100644
--- a/src/libnsdb/fileserver.c
+++ b/src/libnsdb/fileserver.c
@@ -781,6 +781,8 @@  nsdb_resolve_fsn_parse_entry(LDAP *ld, LDAPMessage *entry,
 	if (retval != FEDFS_OK) {
 		xlog(D_CALL, "%s: parsing failed: %s",
 			__func__, nsdb_display_fedfsstatus(retval));
+		free(new->fl_dn);
+		free(new);
 		return retval;
 	}