ustctl: Fix memory allocation problem with compatibility args
authorJason Wessel <jason.wessel@windriver.com>
Thu, 3 Mar 2011 02:21:07 +0000 (21:21 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Thu, 3 Mar 2011 02:21:07 +0000 (21:21 -0500)
The parenthesis were missing to make the malloc math have the correct
precedence.  The addition needs to occur before the multiplication.
The result is the same but for clarity also change change char ** to
char * because we are allocating an array of char pointers.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
ustctl/ustctl.c

index d642178a0a5c0019aa05e86c9fb2ace38ec4403a..807af8caf616913197e02e5205646a9dd7f4c290 100644 (file)
@@ -121,7 +121,7 @@ int main(int argc, char *argv[])
                case DESTROY_TRACE:
                case ENABLE_MARKER:
                case DISABLE_MARKER:
-                       args = (char **)malloc(sizeof(char **) * argc + 3);
+                       args = (char **)malloc(sizeof(char *) * (argc + 3));
                        optind--;
                        args[optind] = strdup(&argv[optind][2]);
                        for (i = optind + 1; i < argc; i++) {
This page took 0.024112 seconds and 4 git commands to generate.