]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
Fix uninitialized warning
authorLucas De Marchi <lucas.demarchi@intel.com>
Mon, 26 Jan 2015 01:54:05 +0000 (23:54 -0200)
committerLucas De Marchi <lucas.demarchi@intel.com>
Mon, 26 Jan 2015 01:54:05 +0000 (23:54 -0200)
Initialize variable to NULL before calling kmod_module_new_from_lookup().

libkmod/libkmod-module.c: In function 'kmod_module_new_from_lookup.part.4.constprop':
libkmod/libkmod-module.c:192:8: warning: 'depmod' may be used uninitialized in this function [-Wmaybe-uninitialized]
   list = kmod_list_prepend(list, depmod);
        ^
libkmod/libkmod-module.c:173:23: note: 'depmod' was declared here
   struct kmod_module *depmod;

libkmod/libkmod-module.c

index 54bde735854a911ee96241b38103080ae98d89ee..30f15ca84fa3fd85d337f35919a60ea11e792bd4 100644 (file)
@@ -170,7 +170,7 @@ int kmod_module_parse_depline(struct kmod_module *mod, char *line)
        p++;
        for (p = strtok_r(p, " \t", &saveptr); p != NULL;
                                        p = strtok_r(NULL, " \t", &saveptr)) {
-               struct kmod_module *depmod;
+               struct kmod_module *depmod = NULL;
                const char *path;
 
                path = path_join(p, dirnamelen, buf);