GNOME Bugzilla – Bug 338177
Dead code reported by the coverity checker
Last modified: 2006-05-02 21:58:38 UTC
546 void 547 bonobo_activation_registration_env_set_global (GSList *reg_env, 548 gboolean append_if_existing) 549 { 550 Bonobo_ActivationEnvValue *old_buffer; 551 int old_length = 0; 552 553 if (append_if_existing) 554 old_length = global_reg_env._length; 555 556 old_buffer = global_reg_env._buffer; 557 Event new_values: Conditional "reg_env == 0" Also see events: [dead_error_line][dead_error_condition][const][assignment] Maybe this should be if (!global_reg_env) { ...? 558 if (!reg_env) { 559 GSList *l; 560 int i; 561 562 global_reg_env._length = global_reg_env._maximum = old_length + g_slist_length (reg_env); 563 global_reg_env._buffer = Bonobo_ActivationEnvironment_allocbuf (global_reg_env._length); 564 global_reg_env._release = TRUE; 565 566 for (i = 0; i < old_length; i++) 567 Bonobo_ActivationEnvValue_copy ( 568 &global_reg_env._buffer [i], &old_buffer [i]); 569 Event dead_error_condition: On this path, the condition "l != 0" could not be true Event const: After this line, the value of "l" is equal to 0 Event assignment: Assigning "reg_env" to "l" Also see events: [dead_error_line][const][assignment][new_values] 570 for (l = reg_env; l; l = l->next) { Event dead_error_line: Cannot reach this line of code Also see events: [dead_error_condition][const][assignment][new_values] 571 RegistrationEnvValue *val = l->data; 572 573 Bonobo_ActivationEnvValue_set ( 574 &global_reg_env._buffer [++i], val->name, val->value); 575 } 576 577 g_assert (i == global_reg_env._length - 1); 578 } else 579 memset (&global_reg_env, 0, sizeof (Bonobo_ActivationEnvironment)); 580 581 if (old_buffer) 582 CORBA_free (old_buffer); 583 }
Created attachment 64671 [details] [review] possible fix
Hi dudie, good catch - no, it's just the wrong polarity: - if (!reg_env) + if (reg_env) please do commit that.
Done. Thanks for the review :-)