[PATCH] libtracefs: Fix bug in tracefs_instances()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux