* [PATCH 1/4] libss: fix potential memory leak on realloc() failure
@ 2014-01-05  6:26 Theodore Ts'o
  2014-01-05  6:26 ` [PATCH 2/4] libext2fs: fix potential memory leak in qcow2_write_raw_image() Theodore Ts'o
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Theodore Ts'o @ 2014-01-05  6:26 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Theodore Ts'o, Theodore Ts'o
From: Theodore Ts'o <tytso@google.com>
Addresses-Coverity-ID: #295143
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 lib/ss/invocation.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/ss/invocation.c b/lib/ss/invocation.c
index 61c2e35..924427a 100644
--- a/lib/ss/invocation.c
+++ b/lib/ss/invocation.c
@@ -28,7 +28,7 @@ int ss_create_invocation(const char *subsystem_name, const char *version_string,
 {
 	register int sci_idx;
 	register ss_data *new_table;
-	register ss_data **table;
+	register ss_data **table, **rt;
 
 	*code_ptr = 0;
 	table = _ss_table;
@@ -42,10 +42,10 @@ int ss_create_invocation(const char *subsystem_name, const char *version_string,
 
 	for (sci_idx = 1; table[sci_idx] != (ss_data *)NULL; sci_idx++)
 		;
-	table = (ss_data **) realloc((char *)table,
-				     ((unsigned)sci_idx+2)*size);
-	if (table == NULL) {
-		*code_ptr = errno;
+	rt = (ss_data **) realloc((char *)table, ((unsigned)sci_idx+2)*size);
+	if (rt == NULL) {
+		*code_ptr = ENOMEM;
+		free(table);
 		return 0;
 	}
 	table[sci_idx+1] = (ss_data *) NULL;
-- 
1.8.5.rc3.362.gdf10213
^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH 2/4] libext2fs: fix potential memory leak in qcow2_write_raw_image()
  2014-01-05  6:26 [PATCH 1/4] libss: fix potential memory leak on realloc() failure Theodore Ts'o
@ 2014-01-05  6:26 ` Theodore Ts'o
  2014-01-05  6:26 ` [PATCH 3/4] test_extents: fix a possible memory leak Theodore Ts'o
  2014-01-05  6:26 ` [PATCH 4/4] libblkid: fix memory overrun in probe_lvm2 Theodore Ts'o
  2 siblings, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2014-01-05  6:26 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Theodore Ts'o, Theodore Ts'o
From: Theodore Ts'o <tytso@google.com>
Addresses-Coverity-ID: #1049179
Addresses-Coverity-ID: #1049180
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 lib/ext2fs/qcow2.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/ext2fs/qcow2.c b/lib/ext2fs/qcow2.c
index 547edc0..c7cdbee 100644
--- a/lib/ext2fs/qcow2.c
+++ b/lib/ext2fs/qcow2.c
@@ -235,8 +235,10 @@ int qcow2_write_raw_image(int qcow2_fd, int raw_fd,
 	}
 
 	/* Resize the output image to the filesystem size */
-	if (ext2fs_llseek(raw_fd, img.image_size - 1, SEEK_SET) < 0)
-		return errno;
+	if (ext2fs_llseek(raw_fd, img.image_size - 1, SEEK_SET) < 0) {
+		ret = errno;
+		goto out;
+	}
 
 	((char *)copy_buf)[0] = 0;
 	size = write(raw_fd, copy_buf, 1);
-- 
1.8.5.rc3.362.gdf10213
^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH 3/4] test_extents: fix a possible memory leak
  2014-01-05  6:26 [PATCH 1/4] libss: fix potential memory leak on realloc() failure Theodore Ts'o
  2014-01-05  6:26 ` [PATCH 2/4] libext2fs: fix potential memory leak in qcow2_write_raw_image() Theodore Ts'o
@ 2014-01-05  6:26 ` Theodore Ts'o
  2014-01-05  6:26 ` [PATCH 4/4] libblkid: fix memory overrun in probe_lvm2 Theodore Ts'o
  2 siblings, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2014-01-05  6:26 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Theodore Ts'o, Theodore Ts'o
From: Theodore Ts'o <tytso@google.com>
Addresses-Coverity-Bug: #1049185
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 resize/test_extent.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/resize/test_extent.c b/resize/test_extent.c
index fa3f505..60aa08f 100644
--- a/resize/test_extent.c
+++ b/resize/test_extent.c
@@ -109,6 +109,8 @@ void do_test(FILE *in, FILE *out)
 		} else
 			fputs("# Syntax error\n", out);
 	}
+	if (extent)
+		ext2fs_free_extent_table(extent);
 }
 
 #ifdef __GNUC__
-- 
1.8.5.rc3.362.gdf10213
^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH 4/4] libblkid: fix memory overrun in probe_lvm2
  2014-01-05  6:26 [PATCH 1/4] libss: fix potential memory leak on realloc() failure Theodore Ts'o
  2014-01-05  6:26 ` [PATCH 2/4] libext2fs: fix potential memory leak in qcow2_write_raw_image() Theodore Ts'o
  2014-01-05  6:26 ` [PATCH 3/4] test_extents: fix a possible memory leak Theodore Ts'o
@ 2014-01-05  6:26 ` Theodore Ts'o
  2 siblings, 0 replies; 4+ messages in thread
From: Theodore Ts'o @ 2014-01-05  6:26 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Theodore Ts'o, Theodore Ts'o
From: Theodore Ts'o <tytso@google.com>
Addresses-Coverity-ID: #1049167
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 lib/blkid/probe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/blkid/probe.c b/lib/blkid/probe.c
index 6f74bd4..dd3604e 100644
--- a/lib/blkid/probe.c
+++ b/lib/blkid/probe.c
@@ -1360,7 +1360,7 @@ static int probe_lvm2(struct blkid_probe *probe,
 		return 1;
 	}
 
-	for (i=0, b=1, p=uuid, q= (char *) label->pv_uuid; i <= 32;
+	for (i=0, b=1, p=uuid, q= (char *) label->pv_uuid; i < LVM2_ID_LEN;
 	     i++, b <<= 1) {
 		if (b & 0x4444440)
 			*p++ = '-';
-- 
1.8.5.rc3.362.gdf10213
^ permalink raw reply related	[flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-01-05  6:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-05  6:26 [PATCH 1/4] libss: fix potential memory leak on realloc() failure Theodore Ts'o
2014-01-05  6:26 ` [PATCH 2/4] libext2fs: fix potential memory leak in qcow2_write_raw_image() Theodore Ts'o
2014-01-05  6:26 ` [PATCH 3/4] test_extents: fix a possible memory leak Theodore Ts'o
2014-01-05  6:26 ` [PATCH 4/4] libblkid: fix memory overrun in probe_lvm2 Theodore Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).