Some coverity fixes
Volker Lendecke
Volker.Lendecke at SerNet.DE
Sun Oct 20 09:42:46 MDT 2013
Hi!
Please review&push!
Thanks,
Volker
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
>From cdf70fab8bee3e01949d8fbce15a7d8a452ef594 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Sun, 20 Oct 2013 17:11:16 +0200
Subject: [PATCH 1/4] ntvfs: Fix Coverity ID 1107224 Resource leak
In this error path we were leaking "fd".
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source4/ntvfs/posix/pvfs_open.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c
index a095f74..ceee642 100644
--- a/source4/ntvfs/posix/pvfs_open.c
+++ b/source4/ntvfs/posix/pvfs_open.c
@@ -717,7 +717,9 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
if (io->generic.in.query_maximal_access) {
status = pvfs_access_maximal_allowed(pvfs, req, name,
&io->generic.out.maximal_access);
- NT_STATUS_NOT_OK_RETURN(status);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto cleanup_delete;
+ }
}
/* form the lock context used for byte range locking and
--
1.7.9.5
>From 71cc90c11ef293762f0062abc0c778483a127bdc Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Sun, 20 Oct 2013 17:16:11 +0200
Subject: [PATCH 2/4] ntvfs: Fix CID 1107225 Resource leak
After the talloc_strdup, we don't need cwd anymore.
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source4/ntvfs/posix/pvfs_sys.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/source4/ntvfs/posix/pvfs_sys.c b/source4/ntvfs/posix/pvfs_sys.c
index 5775d0b..eb710f6 100644
--- a/source4/ntvfs/posix/pvfs_sys.c
+++ b/source4/ntvfs/posix/pvfs_sys.c
@@ -196,9 +196,11 @@ static struct pvfs_sys_ctx *pvfs_sys_pushdir(struct pvfs_state *pvfs,
talloc_free(ctx);
return NULL;
}
+
ctx->old_wd = talloc_strdup(ctx, cwd);
+ free(cwd);
+
if (ctx->old_wd == NULL) {
- free(cwd);
talloc_free(ctx);
return NULL;
}
--
1.7.9.5
>From a817084e65bc59030db421467e72823bfa708cc6 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Sun, 20 Oct 2013 17:25:27 +0200
Subject: [PATCH 3/4] winbind3: Fix CID 241468 Resource leak
We were leaking centry in this error case
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/winbindd/winbindd_cache.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c
index 7252927..91c19fa 100644
--- a/source3/winbindd/winbindd_cache.c
+++ b/source3/winbindd/winbindd_cache.c
@@ -2090,6 +2090,7 @@ static NTSTATUS rids_to_names(struct winbindd_domain *domain,
} else {
/* something's definitely wrong */
result = centry->status;
+ centry_free(centry);
goto error;
}
--
1.7.9.5
>From 74b95602834eecf19ad3ad128bbd4c8225d06bf6 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Sun, 20 Oct 2013 17:29:29 +0200
Subject: [PATCH 4/4] ldb: Fix CID 240798 Uninitialized pointer read
Not called right now, because nobody tries multiple sort attributes. But if
someone did, build_response would have looked at the uninitialized controls.
Signed-off-by: Volker Lendecke <vl at samba.org>
---
lib/ldb/modules/sort.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/ldb/modules/sort.c b/lib/ldb/modules/sort.c
index c6fce2d..1b762f7 100644
--- a/lib/ldb/modules/sort.c
+++ b/lib/ldb/modules/sort.c
@@ -252,7 +252,6 @@ static int server_sort_search(struct ldb_module *module, struct ldb_request *req
struct ldb_control *control;
struct ldb_server_sort_control **sort_ctrls;
struct ldb_control **saved_controls;
- struct ldb_control **controls;
struct ldb_request *down_req;
struct sort_context *ac;
struct ldb_context *ldb;
@@ -286,6 +285,7 @@ static int server_sort_search(struct ldb_module *module, struct ldb_request *req
if (sort_ctrls[1] != NULL) {
if (control->critical) {
+ struct ldb_control **controls = NULL;
/* callback immediately */
ret = build_response(req, &controls,
--
1.7.9.5
More information about the samba-technical
mailing list