#1889 coverity: dead code in sudo client
Closed: Fixed None Opened 11 years ago by pbrezina.

231void sss_sudo_free_attrs(unsigned int num_attrs, struct sss_sudo_attr *attrs)
232{
233    struct sss_sudo_attr *attr = NULL;;
234    int i, j;
235

cond_notnull: Condition "attrs == NULL", taking false branch. Now the value of "attrs" is not NULL.
236    if (attrs == NULL) {
237        return;
238    }
239
240    for (i = 0; i < num_attrs; i++) {

assignment: Assigning: "attr" = "attrs + i".
241        attr = attrs + i;
242

notnull: At condition "attr == NULL", the value of "attr" cannot be NULL.

dead_error_condition: The condition "attr == NULL" cannot be true.
243        if (attr == NULL) {

CID 10015 (#1 of 1): Logically dead code (DEADCODE)dead_error_line: Execution cannot reach this statement "continue;".
244            continue;
245        }
246
247        free(attr->name);
248        attr->name = NULL;
249
250        for (j = 0; j < attr->num_values; j++) {
251            free(attr->values[j]);
252            attr->values[j] = NULL;
253        }
254
255        free(attr->values);
256    }
257
258    free(attrs);
259}

208void sss_sudo_free_rules(unsigned int num_rules, struct sss_sudo_rule *rules)
209{
210    struct sss_sudo_rule *rule = NULL;
211    int i;
212

cond_notnull: Condition "rules == NULL", taking false branch. Now the value of "rules" is not NULL.
213    if (rules == NULL) {
214        return;
215    }
216
217    for (i = 0; i < num_rules; i++) {

assignment: Assigning: "rule" = "rules + i".
218        rule = rules + i;
219

notnull: At condition "rule == NULL", the value of "rule" cannot be NULL.

dead_error_condition: The condition "rule == NULL" cannot be true.
220        if (rule == NULL) {

CID 10016 (#1 of 1): Logically dead code (DEADCODE)dead_error_line: Execution cannot reach this statement "continue;".
221            continue;
222        }
223
224        sss_sudo_free_attrs(rule->num_attrs, rule->attrs);
225        rule->attrs = NULL;
226    }
227
228    free(rules);
229}

Fields changed

owner: somebody => pbrezina
patch: 0 => 1
status: new => assigned

Fields changed

milestone: NEEDS_TRIAGE => SSSD 1.10 beta
rhbz: => 0

Fields changed

resolution: => fixed
status: assigned => closed

Metadata Update from @pbrezina:
- Issue assigned to pbrezina
- Issue set to the milestone: SSSD 1.10 beta

7 years ago

SSSD is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in SSSD's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/SSSD/sssd/issues/2931

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Login to comment on this ticket.

Metadata