summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/modules.c
diff options
context:
space:
mode:
Diffstat (limited to 'mdk-stage1/modules.c')
-rw-r--r--mdk-stage1/modules.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/mdk-stage1/modules.c b/mdk-stage1/modules.c
index 1b3e91d84..b3376520d 100644
--- a/mdk-stage1/modules.c
+++ b/mdk-stage1/modules.c
@@ -146,19 +146,17 @@ int load_modules_dependencies(void)
while (start && *start) {
ptr = strchr(start, ' ');
if (ptr) *ptr = '\0';
- tmp_deps[i] = strdup(start);
+ tmp_deps[i++] = strdup(start);
if (ptr)
start = ptr + 1;
else
start = NULL;
- i++;
while (start && *start && *start == ' ')
start++;
}
- tmp_deps[i] = NULL;
+ tmp_deps[i++] = NULL;
- modules_deps[line].deps = (char **) malloc(sizeof(char *) * (i+1));
- memcpy(modules_deps[line].deps, tmp_deps, sizeof(char *) * (i+1));
+ modules_deps[line].deps = memdup(tmp_deps, sizeof(char *) * i);
line++;
start = end + 1;