[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[PATCH 2/4] Do not assume we found a module in addOption() in loader/modules.c
- From: David Cantrell <dcantrell redhat com>
- To: anaconda-devel-list redhat com
- Cc:
- Subject: [PATCH 2/4] Do not assume we found a module in addOption() in loader/modules.c
- Date: Thu, 17 Sep 2009 14:26:38 -1000
Avoid SIGSEGV in addOption() in loader/modules.c. Just because found
does not equal 0 does not mean we found the module requested.
---
loader/modules.c | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/loader/modules.c b/loader/modules.c
index bddda2b..d5129b7 100644
--- a/loader/modules.c
+++ b/loader/modules.c
@@ -115,17 +115,21 @@ static void addOption(const char *module, const char *option) {
found = 1;
break;
}
- if (found == 0) {
+
+ if (found) {
+ modopts[i].options = realloc(modopts[i].options,
+ sizeof(modopts[i].options) *
+ (modopts[i].numopts + 1));
+ modopts[i].options[modopts[i].numopts - 1] = strdup(option);
+ modopts[i].options[modopts[i].numopts] = NULL;
+ } else {
modopts = realloc(modopts, sizeof(*modopts) * (nummodopts + 1));
modopts[nummodopts].name = strdup(module);
modopts[nummodopts].numopts = 1;
modopts[nummodopts++].options = NULL;
}
- modopts[i].options = realloc(modopts[i].options,
- sizeof(modopts[i].options) *
- (modopts[i].numopts + 1));
- modopts[i].options[modopts[i].numopts - 1] = strdup(option);
- modopts[i].options[modopts[i].numopts] = NULL;
+
+ return;
}
static int isValidModule(char *module) {
--
1.6.2.5
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]