Re: [PATCH] Fix SIGSEGV in dlabel feature (#556390)

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

 



Hi,

-ENOMEANINGFULLCOMMITMSG

Regards,

Hans

On 01/19/2010 01:44 PM, Martin Sivak wrote:
---
  loader/driverdisk.c |   11 ++++-------
  loader/loader.c     |    7 +++++++
  2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/loader/driverdisk.c b/loader/driverdisk.c
index e2acbc8..769d075 100644
--- a/loader/driverdisk.c
+++ b/loader/driverdisk.c
@@ -841,20 +841,17 @@ GSList* findDriverDiskByLabel(void)
          return NULL;
      }

-    if ((ddDevice = g_slist_alloc())==NULL) {
-        logMessage(ERROR, "Cannot allocate space for list of devices");
-        return NULL;
-    }
-
      bIter = blkid_dev_iterate_begin(bCache);
      blkid_dev_set_search(bIter, "LABEL", ddLabel);
      while ((res = blkid_dev_next(bIter,&bDev)) == 0) {
          bDev = blkid_verify(bCache, bDev);
          if (!bDev)
              continue;
+
+        char *devname = strdup(blkid_dev_devname(bDev));
          logMessage(DEBUGLVL, "Adding driver disc %s to the list "
-                             "of available DDs.", blkid_dev_devname(bDev));
-        ddDevice = g_slist_prepend(ddDevice, (gpointer)blkid_dev_devname(bDev));
+                             "of available DDs.", devname);
+        ddDevice = g_slist_prepend(ddDevice, (gpointer)devname);
          /* Freeing bDev is taken care of by the put cache call */
      }
      blkid_dev_iterate_end(bIter);
diff --git a/loader/loader.c b/loader/loader.c
index d8d5fd5..9bf7c2f 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -1971,12 +1971,19 @@ int main(int argc, char ** argv) {
          dd = findDriverDiskByLabel();
          dditer = dd;
          while(dditer) {
+            /* load the DD */
              if (loadDriverDiskFromPartition(&loaderData, (char*)(dditer->data))) {
                  logMessage(ERROR, "Automatic driver disk loader failed for %s.", (char*)(dditer->data));
              }
              else {
                  logMessage(INFO, "Automatic driver disk loader succeeded for %s.", (char*)(dditer->data));
              }
+
+            /* clean the device record */
+            free((char*)(dditer->data));
+            dditer->data = NULL;
+
+            /* next DD */
              dditer = g_slist_next(dditer);
          }
          g_slist_free(dd);

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux