linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libtracefs: Fix bug in tracefs_instances()
@ 2021-07-07 13:05 Yordan Karadzhov (VMware)
  2021-07-07 13:47 ` Steven Rostedt
  0 siblings, 1 reply; 2+ messages in thread
From: Yordan Karadzhov (VMware) @ 2021-07-07 13:05 UTC (permalink / raw)
  To: rostedt; +Cc: linux-trace-devel, Yordan Karadzhov (VMware)

The empty string is now made of two elements, because of the hidden
first element that stores its size.

Fixes: 056a177 (libtracefs: Restructure how string lists work)
Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 src/tracefs-instance.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tracefs-instance.c b/src/tracefs-instance.c
index 11fb580..d601db2 100644
--- a/src/tracefs-instance.c
+++ b/src/tracefs-instance.c
@@ -694,7 +694,7 @@ char **tracefs_instances(const char *regex)
 	} else {
 		/* No matches should produce an empty list */
 		if (!list.list)
-			list.list = calloc(1, sizeof(*list.list));
+			list.list = trace_list_create_empty();
 	}
 	return list.list;
 }
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] libtracefs: Fix bug in tracefs_instances()
  2021-07-07 13:05 [PATCH] libtracefs: Fix bug in tracefs_instances() Yordan Karadzhov (VMware)
@ 2021-07-07 13:47 ` Steven Rostedt
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2021-07-07 13:47 UTC (permalink / raw)
  To: Yordan Karadzhov (VMware); +Cc: linux-trace-devel

On Wed,  7 Jul 2021 16:05:23 +0300
"Yordan Karadzhov (VMware)" <y.karadz@gmail.com> wrote:

> The empty string is now made of two elements, because of the hidden
> first element that stores its size.
> 
> Fixes: 056a177 (libtracefs: Restructure how string lists work)
> Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
> ---
>  src/tracefs-instance.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/tracefs-instance.c b/src/tracefs-instance.c
> index 11fb580..d601db2 100644
> --- a/src/tracefs-instance.c
> +++ b/src/tracefs-instance.c
> @@ -694,7 +694,7 @@ char **tracefs_instances(const char *regex)
>  	} else {
>  		/* No matches should produce an empty list */
>  		if (!list.list)
> -			list.list = calloc(1, sizeof(*list.list));
> +			list.list = trace_list_create_empty();
>  	}
>  	return list.list;
>  }

Thanks! I guess I missed one :-p

-- Steve

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-07 13:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07 13:05 [PATCH] libtracefs: Fix bug in tracefs_instances() Yordan Karadzhov (VMware)
2021-07-07 13:47 ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).