diff options
author | Noriko Hosoi <nhosoi@redhat.com> | 2010-06-29 13:33:34 -0700 |
---|---|---|
committer | Noriko Hosoi <nhosoi@redhat.com> | 2010-07-07 17:15:38 -0700 |
commit | 56c057e2559cec6acf845cb3196eabb1c7363f7e (patch) | |
tree | dc2062ad8d3b530d28261f37490df8b005bc053b /lib | |
parent | 85eb9216d5d4163139a90432084452cf81c8444e (diff) | |
download | ds-56c057e2559cec6acf845cb3196eabb1c7363f7e.tar.gz ds-56c057e2559cec6acf845cb3196eabb1c7363f7e.tar.xz ds-56c057e2559cec6acf845cb3196eabb1c7363f7e.zip |
609255 - fix coverity Defect Type: Memory - illegal accesses issues
https://bugzilla.redhat.com/show_bug.cgi?id=609255
12300 USE_AFTER_FREE Triaged Unassigned Bug Minor Fix Required
append_acl_to_file(char *, char *, char *…) ds/lib/libaccess/acltools.cpp
Comment:
this code is not used any more. The fix is to have open_file_buf set
*buf to NULL after freeing
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libaccess/acltools.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libaccess/acltools.cpp b/lib/libaccess/acltools.cpp index 1b302df4..c93bbc6d 100644 --- a/lib/libaccess/acltools.cpp +++ b/lib/libaccess/acltools.cpp @@ -2131,8 +2131,10 @@ open_cleanup: if (rv<0) { if (*file) fclose(*file); - if (*buf) + if (*buf) { PERM_FREE(*buf); + *buf = NULL; + } } return rv; } @@ -2152,7 +2154,9 @@ close_file_buf(FILE * file, char * filename, char * mode, char * buf) fwrite(buf,1,strlen(buf),file); fclose(file); } - PERM_FREE(buf); + if (*buf) { + PERM_FREE(buf); + } } |