[PATCH i-g-t v13 03/11] tests/intel/*_intel_bb: handle base64 encode fail
Jeevaka Prabu Badrappan
jeevaka.badrappan at intel.com
Tue Jun 3 16:37:06 UTC 2025
g_base64_encode function returns a newly allocated string containing
the Base64 encoded data. Upon failure, null can be returned.
When g_base64_encode function fails, exit the calling function with
error.
Signed-off-by: Jeevaka Prabu Badrappan <jeevaka.badrappan at intel.com>
Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
---
tests/intel/api_intel_bb.c | 3 +++
tests/intel/xe_intel_bb.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/tests/intel/api_intel_bb.c b/tests/intel/api_intel_bb.c
index 4a1c9be91..63e171e16 100644
--- a/tests/intel/api_intel_bb.c
+++ b/tests/intel/api_intel_bb.c
@@ -944,6 +944,9 @@ static int dump_base64(const char *name, struct intel_buf *buf)
igt_info("--- %s ---\n", name);
pos = str = g_base64_encode(destbuf, outsize);
+ if (!str)
+ return -1;
+
outsize = strlen(str);
while (pos) {
char line[LINELEN + 1];
diff --git a/tests/intel/xe_intel_bb.c b/tests/intel/xe_intel_bb.c
index d8bd7b519..c673eb11e 100644
--- a/tests/intel/xe_intel_bb.c
+++ b/tests/intel/xe_intel_bb.c
@@ -595,6 +595,9 @@ static int dump_base64(const char *name, struct intel_buf *buf)
igt_info("--- %s ---\n", name);
pos = str = g_base64_encode(destbuf, outsize);
+ if (!str)
+ return -1;
+
outsize = strlen(str);
while (pos) {
char line[LINELEN + 1];
--
2.49.0
More information about the igt-dev
mailing list