Page MenuHomeFreeBSD

Fix memory leak in mount
Needs RevisionPublic

Authored by trix_juniper.net on Mar 20 2017, 3:30 PM.

Details

Reviewers
rodrigc
cem
Summary

getmntopts.c build_iovec_argf
Introduce a new variable 'sval' to hold memory allocated with strdup and to free it when unused.

Test Plan

Use clang's static analyzer, scan-build, to find the problem and later to show resolution.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

cem edited edge metadata.Mar 20 2017, 3:57 PM

Please upload diffs with context. (Either use diff -U999999 and upload, or use the arc tool associated with Phabricator.)

More surrounding context

cem requested changes to this revision.Mar 20 2017, 4:22 PM

This change is bogus. The strdup() memory is owned by the iov structure (iov_base in build_iovec()) and needed by callers. Callers will later free the memory via free_iovec().

This revision now requires changes to proceed.Mar 20 2017, 4:22 PM