272aca8
From e22e7ddbc90ab817d5304dc4a5f73ed1e9148c16 Mon Sep 17 00:00:00 2001
272aca8
From: Pavel Raiskup <praiskup@redhat.com>
272aca8
Date: Wed, 28 Nov 2018 16:15:31 +0100
272aca8
Subject: [PATCH] covscan fixes
272aca8
272aca8
- two resource leaks (fixed upstream)
272aca8
- dropped trailing semicolon which generated several errors (fixed
272aca8
upstream)
272aca8
---
272aca8
 libdeflt/default.c | 6 +++---
272aca8
 star/hole.c        | 1 +
272aca8
 star/xheader.c     | 3 +--
272aca8
 3 files changed, 5 insertions(+), 5 deletions(-)
272aca8
272aca8
diff --git a/libdeflt/default.c b/libdeflt/default.c
272aca8
index 950e590..5ee1ef2 100644
272aca8
--- a/libdeflt/default.c
272aca8
+++ b/libdeflt/default.c
272aca8
@@ -45,12 +45,12 @@ EXPORT int
272aca8
 defltopen(name)
272aca8
 	const char	*name;
272aca8
 {
272aca8
-	if (dfltfile != (FILE *)NULL)
272aca8
+	if (dfltfile != (FILE *)NULL) {
272aca8
 		fclose(dfltfile);
272aca8
+		dfltfile = NULL;
272aca8
+	}
272aca8
 
272aca8
 	if (name == (char *)NULL) {
272aca8
-		fclose(dfltfile);
272aca8
-		dfltfile = NULL;
272aca8
 		return (0);
272aca8
 	}
272aca8
 
272aca8
diff --git a/star/hole.c b/star/hole.c
272aca8
index c200ec9..6deb38b 100644
272aca8
--- a/star/hole.c
272aca8
+++ b/star/hole.c
272aca8
@@ -1187,6 +1187,7 @@ put_sparse(fp, info)
272aca8
 			 * region of at least TBLOCK size.
272aca8
 			 */
272aca8
 			put_file(fp, info);
272aca8
+			free(sparse);
272aca8
 			return;
272aca8
 		} else if (!silent) {
272aca8
 			error("Treating '%s' as sparse\n", info->f_name);
272aca8
diff --git a/star/xheader.c b/star/xheader.c
272aca8
index a619e28..786b473 100644
272aca8
--- a/star/xheader.c
272aca8
+++ b/star/xheader.c
272aca8
@@ -146,8 +146,7 @@ LOCAL	Uchar	dtab[] = "0123456789";
272aca8
 					(val) = (val) / (unsigned)10;	      \
272aca8
 				} while ((val) > 0)
272aca8
 
272aca8
-#define	scopy(to, from)		while ((*(to)++ = *(from)++) != '\0')	\
272aca8
-					;
272aca8
+#define	scopy(to, from)		while ((*(to)++ = *(from)++) != '\0')
272aca8
 
272aca8
 
272aca8
 LOCAL	char	*xbuf;	/* Space used to prepare I/O from/to extended headers */
272aca8
-- 
272aca8
2.19.1
272aca8