[PATCH i-g-t v14 01/11] lib/intel_batchbuffer: handle base64 encode fail

Jeevaka Prabu Badrappan jeevaka.badrappan at intel.com
Tue Jun 3 19:23:44 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.

Signed-off-by: Jeevaka Prabu Badrappan <jeevaka.badrappan at intel.com>
Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
---
 lib/intel_batchbuffer.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index f7569e768..a0c3fe340 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -2348,6 +2348,9 @@ static void intel_bb_dump_base64(struct intel_bb *ibb, int linelen)
 
 	igt_info("--- bb ---\n");
 	pos = str = g_base64_encode((const guchar *) ibb->batch, ibb->size);
+	if (!str)
+		return;
+
 	outsize = strlen(str);
 
 	while (outsize > 0) {
-- 
2.49.0



More information about the igt-dev mailing list