[ltt-dev] [UST PATCH] ustctl: Fix memory allocation problem with compatibility args
Mathieu Desnoyers
mathieu.desnoyers at efficios.com
Wed Mar 2 21:21:34 EST 2011
* Jason Wessel (jason.wessel at windriver.com) wrote:
> 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 at windriver.com>
Merged, thanks!
Mathieu
> ---
> ustctl/ustctl.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/ustctl/ustctl.c b/ustctl/ustctl.c
> index d642178..807af8c 100644
> --- a/ustctl/ustctl.c
> +++ b/ustctl/ustctl.c
> @@ -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++) {
> --
> 1.6.6.2
>
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list