summaryrefslogtreecommitdiffstats
path: root/loader2/modstubs.c
diff options
context:
space:
mode:
authorpknirsch <pknirsch>2004-06-09 12:59:04 +0000
committerpknirsch <pknirsch>2004-06-09 12:59:04 +0000
commitbeefb844884a1fe9f870e5d2566c58c9850f3486 (patch)
tree14e497e7e0b122e83164662e132bbd9d147e2807 /loader2/modstubs.c
parent4d123781d43797e586460c7b9c37c7ec2374447c (diff)
downloadanaconda-beefb844884a1fe9f870e5d2566c58c9850f3486.tar.gz
anaconda-beefb844884a1fe9f870e5d2566c58c9850f3486.tar.xz
anaconda-beefb844884a1fe9f870e5d2566c58c9850f3486.zip
- Fix declaration for finalName and fullName in extractModule to be really
static variables. Otherwise the addresses are no longer valid when the function returns. - Remove bogous double free() of ballPath in case the modules.cgz couldn't be loaded or the install of the CPIO file failed.
Diffstat (limited to 'loader2/modstubs.c')
-rw-r--r--loader2/modstubs.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/loader2/modstubs.c b/loader2/modstubs.c
index 0ae4e1e1a..f27999585 100644
--- a/loader2/modstubs.c
+++ b/loader2/modstubs.c
@@ -49,16 +49,17 @@ static int rmmod_usage() {
static char * extractModule(char * file, char * ballPath, int version,
int *rmObj) {
gzFile fd;
- char finalName[100], fullName[100];
+ /* Make finaleName and fullName REALLY static, otherwise they get dropped
+ from the stack after the function returns and the addresses are no
+ longer valid. */
+ static char finalName[100], fullName[100];
char * chptr = NULL;
if (access(file, R_OK)) {
/* it might be having a ball */
fd = gunzip_open(ballPath);
- if (!fd) {
- free(ballPath);
+ if (!fd)
return NULL;
- }
chptr = strrchr(file, '/');
if (chptr) file = chptr + 1;
@@ -67,10 +68,8 @@ static char * extractModule(char * file, char * ballPath, int version,
/* XXX: leak */
sprintf(fullName, "%s/%s", getModuleLocation(version), file);
- if (installCpioFile(fd, fullName, finalName, 0)) {
- free(ballPath);
+ if (installCpioFile(fd, fullName, finalName, 0))
return NULL;
- }
*rmObj = 1;
file = finalName;