Skip to contentSkip to conversation

tests/qtest/ast2700-smc-test: Fix leak

PATCH Applied Fabiano Rosas 3 participants 4 messages May 9, 2025 – May 13, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/qtest/ast2700-smc-test: Fix leak

ASAN spotted a leak of the memory used to hold the tmp_path:

Direct leak of 35 byte(s) in 1 object(s) allocated from:

    #0 0x55e29aa96da9 in malloc ../projects/compiler-rt/lib/asan/asan_malloc_linux.cpp:69:3
    #1 0x7fe0cfb26518 in g_malloc ../glib/gmem.c:106
    #2 0x7fe0cfb4146e in g_strconcat ../glib/gstrfuncs.c:629
    #3 0x7fe0cfb0a78f in g_get_tmp_name ../glib/gfileutils.c:1742
    #4 0x7fe0cfb0b00b in g_file_open_tmp ../glib/gfileutils.c:1802
    #5 0x55e29ab53961 in test_ast2700_evb ../tests/qtest/ast2700-smc-test.c:20:10
    #6 0x55e29ab53803 in main ../tests/qtest/ast2700-smc-test.c:65:5
    #7 0x7fe0cf7bd24c in __libc_start_main ../csu/libc-start.c:308
    #8 0x55e29a9f7759 in _start ../sysdeps/x86_64/start.S:120
---
 tests/qtest/ast2700-smc-test.c | 1 +
 1 file changed, 1 insertion(+)
tests/qtest/ast2700-smc-test.c +1 -0
index d1c4856307..62d538d8a3 100644
@@ -67,5 +67,6 @@ int main(int argc, char **argv)
 
     qtest_quit(ast2700_evb_data.s);
     unlink(ast2700_evb_data.tmp_path);
+    g_free(ast2700_evb_data.tmp_path);
     return ret;
 }
Signature · 1 line
2.35.3
#1 lore raw

Jamin, could you check please ?

Thanks,

C.

Quoted 29 lines · Fabiano Rosas

ASAN spotted a leak of the memory used to hold the tmp_path:

Direct leak of 35 byte(s) in 1 object(s) allocated from:

     #0 0x55e29aa96da9 in malloc ../projects/compiler-rt/lib/asan/asan_malloc_linux.cpp:69:3
     #1 0x7fe0cfb26518 in g_malloc ../glib/gmem.c:106
     #2 0x7fe0cfb4146e in g_strconcat ../glib/gstrfuncs.c:629
     #3 0x7fe0cfb0a78f in g_get_tmp_name ../glib/gfileutils.c:1742
     #4 0x7fe0cfb0b00b in g_file_open_tmp ../glib/gfileutils.c:1802
     #5 0x55e29ab53961 in test_ast2700_evb ../tests/qtest/ast2700-smc-test.c:20:10
     #6 0x55e29ab53803 in main ../tests/qtest/ast2700-smc-test.c:65:5
     #7 0x7fe0cf7bd24c in __libc_start_main ../csu/libc-start.c:308
     #8 0x55e29a9f7759 in _start ../sysdeps/x86_64/start.S:120
---
  tests/qtest/ast2700-smc-test.c | 1 +
  1 file changed, 1 insertion(+)
tests/qtest/ast2700-smc-test.c +1 -0
index d1c4856307..62d538d8a3 100644
@@ -67,5 +67,6 @@ int main(int argc, char **argv)
 
      qtest_quit(ast2700_evb_data.s);
      unlink(ast2700_evb_data.tmp_path);
+    g_free(ast2700_evb_data.tmp_path);
      return ret;
  }
Reviewed-by
#2 lore raw
Quoted 37 lines

Jamin, could you check please ?

Thanks,

C.

Quoted 4 lines · Fabiano Rosas

ASAN spotted a leak of the memory used to hold the tmp_path:

Direct leak of 35 byte(s) in 1 object(s) allocated from:

     #0 0x55e29aa96da9 in

malloc ../projects/compiler-rt/lib/asan/asan_malloc_linux.cpp:69:3

Quoted 5 lines
     #1 0x7fe0cfb26518 in g_malloc ../glib/gmem.c:106
     #2 0x7fe0cfb4146e in g_strconcat ../glib/gstrfuncs.c:629
     #3 0x7fe0cfb0a78f in g_get_tmp_name ../glib/gfileutils.c:1742
     #4 0x7fe0cfb0b00b in g_file_open_tmp ../glib/gfileutils.c:1802
     #5 0x55e29ab53961 in

test_ast2700_evb ../tests/qtest/ast2700-smc-test.c:20:10

Quoted 15 lines
     #6 0x55e29ab53803 in main ../tests/qtest/ast2700-smc-test.c:65:5
     #7 0x7fe0cf7bd24c in __libc_start_main ../csu/libc-start.c:308
     #8 0x55e29a9f7759 in _start ../sysdeps/x86_64/start.S:120
---
  tests/qtest/ast2700-smc-test.c | 1 +
  1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/tests/qtest/ast2700-smc-test.c index d1c4856307..62d538d8a3 100644

tests/qtest/ast2700-smc-test.c +0 -0
@@ -67,5 +67,6 @@ int main(int argc, char **argv)
 
Quoted 5 lines

tests/qtest/ast2700-smc-test.c int main(int argc, char **argv) · line 72

Quoted 5 lines
tests/qtest/ast2700-smc-test.c +1 -0
      qtest_quit(ast2700_evb_data.s);
      unlink(ast2700_evb_data.tmp_path);
+    g_free(ast2700_evb_data.tmp_path);
      return ret;
  }

Thanks-Jamin

#3 lore raw
In reply to Fabiano Rosas
Quoted 23 lines · Fabiano Rosas

ASAN spotted a leak of the memory used to hold the tmp_path:

Direct leak of 35 byte(s) in 1 object(s) allocated from:

     #0 0x55e29aa96da9 in malloc ../projects/compiler-rt/lib/asan/asan_malloc_linux.cpp:69:3
     #1 0x7fe0cfb26518 in g_malloc ../glib/gmem.c:106
     #2 0x7fe0cfb4146e in g_strconcat ../glib/gstrfuncs.c:629
     #3 0x7fe0cfb0a78f in g_get_tmp_name ../glib/gfileutils.c:1742
     #4 0x7fe0cfb0b00b in g_file_open_tmp ../glib/gfileutils.c:1802
     #5 0x55e29ab53961 in test_ast2700_evb ../tests/qtest/ast2700-smc-test.c:20:10
     #6 0x55e29ab53803 in main ../tests/qtest/ast2700-smc-test.c:65:5
     #7 0x7fe0cf7bd24c in __libc_start_main ../csu/libc-start.c:308
     #8 0x55e29a9f7759 in _start ../sysdeps/x86_64/start.S:120
---
  tests/qtest/ast2700-smc-test.c | 1 +
  1 file changed, 1 insertion(+)
tests/qtest/ast2700-smc-test.c +0 -0
index d1c4856307..62d538d8a3 100644

tests/qtest/ast2700-smc-test.c int main(int argc, char **argv) · line 72

Quoted 6 lines
tests/qtest/ast2700-smc-test.c +1 -0
@@ -67,5 +67,6 @@ int main(int argc, char **argv)
 
      qtest_quit(ast2700_evb_data.s);
      unlink(ast2700_evb_data.tmp_path);
+    g_free(ast2700_evb_data.tmp_path);
      return ret;
  }

Applied to aspeed-next.

Thanks,

C.