bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH parted 1/2] linux: fix crash (un-initialized pointer) when operat


From: Hans de Goede
Subject: [PATCH parted 1/2] linux: fix crash (un-initialized pointer) when operating on regular files
Date: Fri, 30 Oct 2009 11:46:22 +0100

* libparted/arch/linux.c (linux_new): When compiled with blkid support
initialize arch_specific->probe and arch_specific->topology to NULL,
as get_blkid_topology(), which sets them, does not get called for
regular files.
* libparted/arch/linux.c (get_blkid_topology): No need to set
arch_specific->topology to NULL, as this now gets done by
linux_new().
---
 libparted/arch/linux.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 3069c59..7908c46 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -598,8 +598,6 @@ _have_kern26 ()
 static void
 get_blkid_topology (LinuxSpecific *arch_specific)
 {
-        arch_specific->topology = NULL;
-
         arch_specific->probe = blkid_new_probe ();
         if (!arch_specific->probe)
                 return;
@@ -1249,6 +1247,10 @@ linux_new (const char* path)
                 goto error_free_path;
         arch_specific = LINUX_SPECIFIC (dev);
         arch_specific->dmtype = NULL;
+#if USE_BLKID
+        arch_specific->probe = NULL;
+        arch_specific->topology = NULL;
+#endif
 
         dev->open_count = 0;
         dev->read_only = 0;
-- 
1.6.5.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]