Both `bt_py_common_format_exception()` and `bt_py_common_format_tb()`
use the same error handling pattern of defining an `error` label and
free-ing `msg_buf` if it has been created before jumping there.
In both cases, the creation of `msg_buf` is the last operation that
can fail, which makes the check, and clean-up, unrechable.
From Coverity's report:
1408326 Logically dead code
The indicated dead code may have performed some action; that action
will never occur.
In bt_py_common_format_tb: Code can never be reached because of a
logical contradiction (CWE-561)
Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I81b5a2db2cefe1fe08e25819bfa2d8e0fd78ee82
Reviewed-on: https://review.lttng.org/c/babeltrace/+/3154
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
goto error;
}
- goto end;
-
error:
- if (msg_buf) {
- g_string_free(msg_buf, TRUE);
- msg_buf = NULL;
- }
-
-end:
Py_XDECREF(traceback_module);
Py_XDECREF(format_tb_func);
Py_XDECREF(exc_str_list);
goto error;
}
- goto end;
-
error:
- if (msg_buf) {
- g_string_free(msg_buf, TRUE);
- msg_buf = NULL;
- }
-
-end:
Py_XDECREF(exc_str_list);
Py_XDECREF(format_exception_func);
Py_XDECREF(traceback_module);