# HG changeset patch # User Paul Eggert # Date 1363710658 25200 # Node ID 8c32877a40e691aff881cedca8cb5ee2773a5195 # Parent 6959449c25f60c20a8c823e90969a88015f2da9e copy-file, rpmatch: fix problems found by cppcheck Reported by Arno Onken in . * lib/rpmatch.c (try): Fix memory leak. * lib/copy-file.c: Include "ignore-value.h". (qcopy_file_preserving): Ignore chown value. * modules/copy-file (Depends-on): Add ignore-value. diff -r 6959449c25f6 -r 8c32877a40e6 ChangeLog --- a/ChangeLog Sun Jan 27 09:54:55 2013 -0800 +++ b/ChangeLog Tue Mar 19 09:30:58 2013 -0700 @@ -1,3 +1,13 @@ +2013-03-19 Paul Eggert + + copy-file, rpmatch: fix problems found by cppcheck + Reported by Arno Onken in + . + * lib/rpmatch.c (try): Fix memory leak. + * lib/copy-file.c: Include "ignore-value.h". + (qcopy_file_preserving): Ignore chown value. + * modules/copy-file (Depends-on): Add ignore-value. + 2013-01-27 Jim Meyering prefix-gnulib-mk: give better diagnostics diff -r 6959449c25f6 -r 8c32877a40e6 lib/copy-file.c --- a/lib/copy-file.c Sun Jan 27 09:54:55 2013 -0800 +++ b/lib/copy-file.c Tue Mar 19 09:30:58 2013 -0700 @@ -37,6 +37,7 @@ #endif #include "error.h" +#include "ignore-value.h" #include "safe-read.h" #include "full-write.h" #include "acl.h" @@ -140,7 +141,7 @@ #if HAVE_CHOWN /* Preserve the owner and group. */ - chown (dest_filename, statbuf.st_uid, statbuf.st_gid); + ignore_value (chown (dest_filename, statbuf.st_uid, statbuf.st_gid)); #endif /* Preserve the access permissions. */ diff -r 6959449c25f6 -r 8c32877a40e6 lib/rpmatch.c --- a/lib/rpmatch.c Sun Jan 27 09:54:55 2013 -0800 +++ b/lib/rpmatch.c Tue Mar 19 09:30:58 2013 -0700 @@ -110,7 +110,10 @@ return -1; /* Compile the pattern and cache it for future runs. */ if (regcomp (re, safe_pattern, REG_EXTENDED) != 0) - return -1; + { + free (safe_pattern); + return -1; + } *lastp = safe_pattern; } diff -r 6959449c25f6 -r 8c32877a40e6 modules/copy-file --- a/modules/copy-file Sun Jan 27 09:54:55 2013 -0800 +++ b/modules/copy-file Tue Mar 19 09:30:58 2013 -0700 @@ -13,6 +13,7 @@ fstat full-write gettext-h +ignore-value open quote safe-read