Some coverity fixes

Volker Lendecke Volker.Lendecke at SerNet.DE
Sun May 12 05:30:48 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 7d954c139de7a882b4f5ac2d772efc0f613101b7 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Sun, 12 May 2013 12:33:49 +0200
Subject: [PATCH 1/3] dbwrap: Fix CID 1002092 Uninitialized scalar variable

We don't set saved_errno in the ret==0 case.

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 lib/dbwrap/dbwrap_ntdb.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/dbwrap/dbwrap_ntdb.c b/lib/dbwrap/dbwrap_ntdb.c
index 5be7b84..658c487 100644
--- a/lib/dbwrap/dbwrap_ntdb.c
+++ b/lib/dbwrap/dbwrap_ntdb.c
@@ -326,7 +326,9 @@ static int timeout_lock(int fd, int rw, off_t off, off_t len, bool waitflag,
 	}
 
 	alarm(0);
-	errno = saved_errno;
+	if (ret != 0) {
+		errno = saved_errno;
+	}
 	return ret;
 }
 
-- 
1.7.9.5


From c3609468dd681fff3611c72d25e0629babf80252 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Sun, 12 May 2013 12:44:41 +0200
Subject: [PATCH 2/3] pthreadpool: Fix CID 710828 Sizeof not portable

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/lib/pthreadpool/pthreadpool.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/lib/pthreadpool/pthreadpool.c b/source3/lib/pthreadpool/pthreadpool.c
index 0430377..c5c9367 100644
--- a/source3/lib/pthreadpool/pthreadpool.c
+++ b/source3/lib/pthreadpool/pthreadpool.c
@@ -407,7 +407,7 @@ static void pthreadpool_server_exit(struct pthreadpool *pool)
 	pool->num_threads -= 1;
 
 	exited = (pthread_t *)realloc(
-		pool->exited, sizeof(pthread_t *) * (pool->num_exited + 1));
+		pool->exited, sizeof(pthread_t) * (pool->num_exited + 1));
 
 	if (exited == NULL) {
 		/* lost a thread status */
-- 
1.7.9.5


From 5b885fd2ef94acf5c71d5cdc695629aafb25e780 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Sun, 12 May 2013 12:47:39 +0200
Subject: [PATCH 3/3] lib: Fix CID 241650 Sizeof not portable

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/lib/util_str.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 314c7ea..967beda 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -1282,7 +1282,7 @@ char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string,
 			list = tmp;
 
 			memset (&list[num], 0,
-				((sizeof(char**)) * (S_LIST_ABS +1)));
+				((sizeof(char*)) * (S_LIST_ABS +1)));
 		}
 
 		list[num] = tok;
-- 
1.7.9.5



More information about the samba-technical mailing list