Detected with libasan on Linux.
struct archive_entry *ae;
const char *name;
const void *value;
+ void *rvalue;
size_t size, insize;
int e, r;
const char *attrname = "user.libarchive.test";
assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a));
assertEqualInt(ARCHIVE_OK, archive_write_free(a));
- value = getXattr("writetest", attrname, &insize);
+ rvalue = getXattr("writetest", attrname, &insize);
if (assertEqualInt(insize, strlen(writeval) + 1) != 0)
- assertEqualMem(value, writeval, insize);
+ assertEqualMem(rvalue, writeval, insize);
+ free(rvalue);
#endif
}
if (richacl_a != NULL) {
richacl_b = richacl_get_file(path_b);
if (richacl_b == NULL &&
- (errno == ENODATA || errno == ENOTSUP || errno == ENOSYS))
+ (errno == ENODATA || errno == ENOTSUP || errno == ENOSYS)) {
+ richacl_free(richacl_a);
return (0);
+ }
failure("richacl_get_file() error: %s (%s)", path_b,
strerror(errno));
if (assert(richacl_b != NULL) == 0) {
const char *testattr = "user.libarchive.test";
const char *testval = "testval";
- const void *readval;
+ void *readval;
size_t size;
int r;
readval = getXattr("xattrs_xattrs/f", testattr, &size);
if(assertEqualInt(size, strlen(testval) + 1) != 0)
assertEqualMem(readval, testval, size);
+ free(readval);
/* Extract xattrs without xattrs */
assertMakeDir("xattrs_noxattrs", 0755);
int setTestAcl(const char *path);
/* Get extended attribute */
-const void *getXattr(const char *, const char *, size_t *);
+void *getXattr(const char *, const char *, size_t *);
/* Set extended attribute */
int setXattr(const char *, const char *, const void *, size_t);
return (0);
}
-/* Get extended attribute from a path */
-const void *
+/* Get extended attribute value from a path */
+void *
getXattr(const char *path, const char *name, size_t *sizep)
{
void *value = NULL;