diff mbox

[06/12] libnsdb: don't leak a read buffer upon certfile open failure

Message ID 20111213225150.15402.43467.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/nsdb.c (nsdb_read_certfile): Free "buf" also
on the failed-open path.  Spotted by coverity.

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

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

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

Patch

diff --git a/src/libnsdb/nsdb.c b/src/libnsdb/nsdb.c
index cab81b7..2ec13e2 100644
--- a/src/libnsdb/nsdb.c
+++ b/src/libnsdb/nsdb.c
@@ -494,6 +494,7 @@  nsdb_read_certfile(const char *pathname, char **certdata,
 	if (fd == -1) {
 		xlog(D_GENERAL, "%s: Failed to open %s: %m",
 			__func__, pathname);
+		free(buf);
 		goto out;
 	}