From: Mathieu Desnoyers Date: Wed, 26 Jul 2017 17:18:01 +0000 (-0400) Subject: Cleanup: identical code for different branches X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=4fde0f03fe680be7f1086adf2f5357ea517c8caa Cleanup: identical code for different branches Found by Coverity: CID 1376174 (#1 of 1): Identical code for different branches (IDENTICAL_BRANCHES)identical_branches: The same code is executed when the condition !trimmer is true or false, because the code in the if-then branch and after the if statement is identical. Should the if statement be removed? Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau --- diff --git a/plugins/utils/trimmer/trimmer.c b/plugins/utils/trimmer/trimmer.c index d3460fbb..352b0cff 100644 --- a/plugins/utils/trimmer/trimmer.c +++ b/plugins/utils/trimmer/trimmer.c @@ -53,14 +53,7 @@ void destroy_trimmer_data(struct trimmer *trimmer) static struct trimmer *create_trimmer_data(void) { - struct trimmer *trimmer; - - trimmer = g_new0(struct trimmer, 1); - if (!trimmer) { - goto end; - } -end: - return trimmer; + return g_new0(struct trimmer, 1); } void finalize_trimmer(struct bt_private_component *component)