[gjs: 1/3] CI: Avoid cppcheck false positive
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 1/3] CI: Avoid cppcheck false positive
- Date: Sun, 22 Nov 2020 23:09:24 +0000 (UTC)
commit f73427e3cc458701b30c76efa4dc1f2fa697e50e
Author: Philip Chimento <philip chimento gmail com>
Date: Fri Nov 20 16:42:45 2020 -0800
CI: Avoid cppcheck false positive
Cppcheck checks for g_strchomp(g_strdup(...)) but doesn't realize that we
are freeing the return value later by storing it in a smart pointer.
Reverse the order of the calls to avoid the false positive.
gjs/debugger.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gjs/debugger.cpp b/gjs/debugger.cpp
index 10cd4807..585024d3 100644
--- a/gjs/debugger.cpp
+++ b/gjs/debugger.cpp
@@ -75,7 +75,7 @@ static bool do_readline(JSContext* cx, unsigned argc, JS::Value* vp) {
fflush(stdout);
if (!fgets(buf, sizeof buf, stdin))
buf[0] = '\0';
- line.reset(g_strchomp(g_strdup(buf)));
+ line.reset(g_strdup(g_strchomp(buf)));
if (!isatty(STDIN_FILENO)) {
if (feof(stdin)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]