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

[PATCH] Fix descriptor leak and iteration progress in driverdisc code (#592225)



---
 loader/driverdisk.c |    3 ++-
 loader/rpmextract.c |   10 ++++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/loader/driverdisk.c b/loader/driverdisk.c
index 72a913d..8fa950a 100644
--- a/loader/driverdisk.c
+++ b/loader/driverdisk.c
@@ -174,8 +174,9 @@ int dlabelUnpackRPMDir(char* rpmdir, char* destination)
     if (!glob(globpattern, GLOB_NOSORT|GLOB_NOESCAPE, globErrFunc, &globres)) {
         /* iterate over all rpm files */
         globitem = globres.gl_pathv;
-        while (globres.gl_pathc>0 && globitem != NULL) {
+        while (globres.gl_pathc>0 && globitem != NULL && *globitem != NULL) {
             explodeRPM(*globitem, dlabelFilter, dlabelProvides, NULL, kernelver);
+            globitem++;
         }
         globfree(&globres);
         /* end of iteration */
diff --git a/loader/rpmextract.c b/loader/rpmextract.c
index 90af54c..2ce0e6b 100644
--- a/loader/rpmextract.c
+++ b/loader/rpmextract.c
@@ -185,8 +185,12 @@ int explodeRPM(const char *source,
             }
         }
         rpmtdFreeData(&td);
-        if (found<=0)
+
+        if (found<=0) {
+            Fclose(fdi);
             return EXIT_BADDEPS;
+        }
+
         break;
     }
 
@@ -292,8 +296,9 @@ int explodeRPM(const char *source,
                 needskip = 0;
             } else {
                 needskip = 0;
-                fclose(fdout);
             }
+
+            fclose(fdout);
         }
 
         /* symlink, we assume that the path contained in symlink
@@ -319,6 +324,7 @@ int explodeRPM(const char *source,
     }
 
     archive_read_finish(cpio);
+    Fclose(gzdi);
 
     return rc != ARCHIVE_OK;
 }
-- 
1.6.6.1


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