]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/mangle: fix possible null pointer dereference [cppcheck]
authorSami Kerola <kerolasa@iki.fi>
Sat, 18 May 2019 21:09:25 +0000 (22:09 +0100)
committerSami Kerola <kerolasa@iki.fi>
Sat, 18 May 2019 21:09:25 +0000 (22:09 +0100)
Fix effects code that is used when testing util-linux, so quite low impact.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
lib/mangle.c

index b514cd8d350ac5894196cd19585a85e2b7d449cb..87802fbda0151058e3feca5bd1ed11a2f9e46db5 100644 (file)
@@ -155,9 +155,9 @@ int main(int argc, char *argv[])
                }
 
                x = strdup(argv[2]);
-               unmangle_to_buffer(x, x, strlen(x) + 1);
-
                if (x) {
+                       unmangle_to_buffer(x, x, strlen(x) + 1);
+
                        printf("self-unmangled: '%s'\n", x);
                        free(x);
                }