star/star-1.5.3-covscan-2018.patch

64 lines
1.6 KiB
Diff
Raw Normal View History

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