mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-22 22:03:43 +03:00
tree-wide: Fix false positives on newer gcc
Recent gcc versions have started to trigger false positive maybe-uninitialized warnings. Let's make sure we initialize variables annotated with _cleanup_ to avoid these. (cherry picked from commit 3d41b6b8e864abbf7b81c938532f42e97a900e22)
This commit is contained in:
parent
58c1816aa4
commit
53bc78d3e0
@ -1239,7 +1239,7 @@ int home_setup_luks(
|
||||
PasswordCache *cache,
|
||||
UserRecord **ret_luks_home) {
|
||||
|
||||
sd_id128_t found_partition_uuid, found_fs_uuid, found_luks_uuid = SD_ID128_NULL;
|
||||
sd_id128_t found_partition_uuid, found_fs_uuid = SD_ID128_NULL, found_luks_uuid = SD_ID128_NULL;
|
||||
_cleanup_(user_record_unrefp) UserRecord *luks_home = NULL;
|
||||
_cleanup_(erase_and_freep) void *volume_key = NULL;
|
||||
size_t volume_key_size = 0;
|
||||
|
@ -72,7 +72,7 @@ static void append_number(ManagedJournalFile *f, int n, uint64_t *seqnum) {
|
||||
|
||||
static void test_check_number(sd_journal *j, int n) {
|
||||
const void *d;
|
||||
_cleanup_free_ char *k;
|
||||
_cleanup_free_ char *k = NULL;
|
||||
size_t l;
|
||||
int x;
|
||||
|
||||
|
@ -186,7 +186,7 @@ static int check_options(uint8_t code, uint8_t len, const void *option, void *us
|
||||
|
||||
int dhcp_network_send_raw_socket(int s, const union sockaddr_union *link, const void *packet, size_t len) {
|
||||
size_t size;
|
||||
_cleanup_free_ DHCPPacket *discover;
|
||||
_cleanup_free_ DHCPPacket *discover = NULL;
|
||||
uint16_t ip_check, udp_check;
|
||||
|
||||
assert_se(s >= 0);
|
||||
|
@ -266,7 +266,7 @@ static void test_sd_device_enumerator_filter_subsystem_one(
|
||||
|
||||
static bool test_sd_device_enumerator_filter_subsystem_trial(void) {
|
||||
_cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
|
||||
_cleanup_(hashmap_freep) Hashmap *subsystems;
|
||||
_cleanup_(hashmap_freep) Hashmap *subsystems = NULL;
|
||||
unsigned n_new_dev = 0, n_removed_dev = 0;
|
||||
sd_device *d;
|
||||
Hashmap *h;
|
||||
|
@ -505,7 +505,7 @@ static void test_inotify_one(unsigned n_create_events) {
|
||||
|
||||
for (i = 0; i < n_create_events; i++) {
|
||||
char buf[DECIMAL_STR_MAX(unsigned)+1];
|
||||
_cleanup_free_ char *z;
|
||||
_cleanup_free_ char *z = NULL;
|
||||
|
||||
xsprintf(buf, "%u", i);
|
||||
assert_se(z = path_join(p, buf));
|
||||
|
@ -27,7 +27,7 @@ static const char *no_catalog_dirs[] = {
|
||||
|
||||
static OrderedHashmap* test_import(const char* contents, ssize_t size, int code) {
|
||||
_cleanup_(unlink_tempfilep) char name[] = "/tmp/test-catalog.XXXXXX";
|
||||
_cleanup_close_ int fd;
|
||||
_cleanup_close_ int fd = -EBADF;
|
||||
OrderedHashmap *h;
|
||||
|
||||
if (size < 0)
|
||||
|
@ -91,7 +91,7 @@ static void print_device(struct udev_device *device) {
|
||||
}
|
||||
|
||||
static void test_device(struct udev *udev, const char *syspath) {
|
||||
_cleanup_(udev_device_unrefp) struct udev_device *device;
|
||||
_cleanup_(udev_device_unrefp) struct udev_device *device = NULL;
|
||||
|
||||
log_info("/* %s, device %s */", __func__, syspath);
|
||||
device = udev_device_new_from_syspath(udev, syspath);
|
||||
@ -102,7 +102,7 @@ static void test_device(struct udev *udev, const char *syspath) {
|
||||
}
|
||||
|
||||
static void test_device_parents(struct udev *udev, const char *syspath) {
|
||||
_cleanup_(udev_device_unrefp) struct udev_device *device;
|
||||
_cleanup_(udev_device_unrefp) struct udev_device *device = NULL;
|
||||
struct udev_device *device_parent;
|
||||
|
||||
log_info("/* %s, device %s */", __func__, syspath);
|
||||
@ -172,7 +172,7 @@ static int enumerate_print_list(struct udev_enumerate *enumerate) {
|
||||
|
||||
static void test_monitor(struct udev *udev) {
|
||||
_cleanup_(udev_monitor_unrefp) struct udev_monitor *udev_monitor;
|
||||
_cleanup_close_ int fd_ep;
|
||||
_cleanup_close_ int fd_ep = -EBADF;
|
||||
int fd_udev;
|
||||
struct epoll_event ep_udev = {
|
||||
.events = EPOLLIN,
|
||||
|
@ -38,7 +38,7 @@ TEST(parse_etc_hosts) {
|
||||
t[] = "/tmp/test-resolved-etc-hosts.XXXXXX";
|
||||
|
||||
int fd;
|
||||
_cleanup_fclose_ FILE *f;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
|
||||
fd = mkostemp_safe(t);
|
||||
assert_se(fd >= 0);
|
||||
@ -118,7 +118,7 @@ TEST(parse_etc_hosts) {
|
||||
|
||||
static void test_parse_file_one(const char *fname) {
|
||||
_cleanup_(etc_hosts_clear) EtcHosts hosts = {};
|
||||
_cleanup_fclose_ FILE *f;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
|
||||
log_info("/* %s(\"%s\") */", __func__, fname);
|
||||
|
||||
|
@ -37,7 +37,7 @@ static void test_policy_closed(const char *cgroup_path, BPFProgram **installed_p
|
||||
"/dev/urandom",
|
||||
"/dev/tty",
|
||||
"/dev/ptmx") {
|
||||
_cleanup_close_ int fd, fd2;
|
||||
_cleanup_close_ int fd = -EBADF, fd2 = -EBADF;
|
||||
|
||||
fd = open(s, O_CLOEXEC|O_RDONLY|O_NOCTTY);
|
||||
log_debug("open(%s, \"r\") = %d/%s", s, fd, fd < 0 ? errno_to_name(errno) : "-");
|
||||
@ -74,7 +74,7 @@ static void test_policy_strict(const char *cgroup_path, BPFProgram **installed_p
|
||||
assert_se(r >= 0);
|
||||
|
||||
{
|
||||
_cleanup_close_ int fd, fd2;
|
||||
_cleanup_close_ int fd = -EBADF, fd2 = -EBADF;
|
||||
const char *s = "/dev/null";
|
||||
|
||||
fd = open(s, O_CLOEXEC|O_RDONLY|O_NOCTTY);
|
||||
@ -87,7 +87,7 @@ static void test_policy_strict(const char *cgroup_path, BPFProgram **installed_p
|
||||
}
|
||||
|
||||
{
|
||||
_cleanup_close_ int fd, fd2;
|
||||
_cleanup_close_ int fd = -EBADF, fd2 = -EBADF;
|
||||
const char *s = "/dev/random";
|
||||
|
||||
fd = open(s, O_CLOEXEC|O_RDONLY|O_NOCTTY);
|
||||
@ -100,7 +100,7 @@ static void test_policy_strict(const char *cgroup_path, BPFProgram **installed_p
|
||||
}
|
||||
|
||||
{
|
||||
_cleanup_close_ int fd, fd2;
|
||||
_cleanup_close_ int fd = -EBADF, fd2 = -EBADF;
|
||||
const char *s = "/dev/zero";
|
||||
|
||||
fd = open(s, O_CLOEXEC|O_RDONLY|O_NOCTTY);
|
||||
@ -113,7 +113,7 @@ static void test_policy_strict(const char *cgroup_path, BPFProgram **installed_p
|
||||
}
|
||||
|
||||
{
|
||||
_cleanup_close_ int fd, fd2;
|
||||
_cleanup_close_ int fd = -EBADF, fd2 = -EBADF;
|
||||
const char *s = "/dev/full";
|
||||
|
||||
fd = open(s, O_CLOEXEC|O_RDONLY|O_NOCTTY);
|
||||
@ -146,7 +146,7 @@ static void test_policy_allow_list_major(const char *pattern, const char *cgroup
|
||||
|
||||
/* /dev/null, /dev/full have major==1, /dev/tty has major==5 */
|
||||
{
|
||||
_cleanup_close_ int fd, fd2;
|
||||
_cleanup_close_ int fd = -EBADF, fd2 = -EBADF;
|
||||
const char *s = "/dev/null";
|
||||
|
||||
fd = open(s, O_CLOEXEC|O_RDONLY|O_NOCTTY);
|
||||
@ -159,7 +159,7 @@ static void test_policy_allow_list_major(const char *pattern, const char *cgroup
|
||||
}
|
||||
|
||||
{
|
||||
_cleanup_close_ int fd, fd2;
|
||||
_cleanup_close_ int fd = -EBADF, fd2 = -EBADF;
|
||||
const char *s = "/dev/full";
|
||||
|
||||
fd = open(s, O_CLOEXEC|O_RDONLY|O_NOCTTY);
|
||||
@ -172,7 +172,7 @@ static void test_policy_allow_list_major(const char *pattern, const char *cgroup
|
||||
}
|
||||
|
||||
{
|
||||
_cleanup_close_ int fd, fd2;
|
||||
_cleanup_close_ int fd = -EBADF, fd2 = -EBADF;
|
||||
const char *s = "/dev/tty";
|
||||
|
||||
fd = open(s, O_CLOEXEC|O_RDONLY|O_NOCTTY);
|
||||
@ -204,7 +204,7 @@ static void test_policy_allow_list_major_star(char type, const char *cgroup_path
|
||||
assert_se(r >= 0);
|
||||
|
||||
{
|
||||
_cleanup_close_ int fd;
|
||||
_cleanup_close_ int fd = -EBADF;
|
||||
const char *s = "/dev/null";
|
||||
|
||||
fd = open(s, O_CLOEXEC|O_RDWR|O_NOCTTY);
|
||||
@ -237,7 +237,7 @@ static void test_policy_empty(bool add_mismatched, const char *cgroup_path, BPFP
|
||||
assert_se(r >= 0);
|
||||
|
||||
{
|
||||
_cleanup_close_ int fd;
|
||||
_cleanup_close_ int fd = -EBADF;
|
||||
const char *s = "/dev/null";
|
||||
|
||||
fd = open(s, O_CLOEXEC|O_RDWR|O_NOCTTY);
|
||||
|
@ -78,7 +78,7 @@ static void test_compress_decompress(const char* label, const char* type,
|
||||
usec_t n, n2 = 0;
|
||||
float dt;
|
||||
|
||||
_cleanup_free_ char *text, *buf;
|
||||
_cleanup_free_ char *text = NULL, *buf = NULL;
|
||||
_cleanup_free_ void *buf2 = NULL;
|
||||
size_t skipped = 0, compressed = 0, total = 0;
|
||||
|
||||
|
@ -150,7 +150,7 @@ TEST(copy_tree) {
|
||||
(void) rm_rf(original_dir, REMOVE_ROOT|REMOVE_PHYSICAL);
|
||||
|
||||
STRV_FOREACH(p, files) {
|
||||
_cleanup_free_ char *f, *c;
|
||||
_cleanup_free_ char *f = NULL, *c = NULL;
|
||||
int k;
|
||||
|
||||
assert_se(f = path_join(original_dir, *p));
|
||||
@ -165,7 +165,7 @@ TEST(copy_tree) {
|
||||
}
|
||||
|
||||
STRV_FOREACH_PAIR(ll, p, symlinks) {
|
||||
_cleanup_free_ char *f, *l;
|
||||
_cleanup_free_ char *f = NULL, *l = NULL;
|
||||
|
||||
assert_se(f = path_join(original_dir, *p));
|
||||
assert_se(l = path_join(original_dir, *ll));
|
||||
@ -175,7 +175,7 @@ TEST(copy_tree) {
|
||||
}
|
||||
|
||||
STRV_FOREACH_PAIR(ll, p, hardlinks) {
|
||||
_cleanup_free_ char *f, *l;
|
||||
_cleanup_free_ char *f = NULL, *l = NULL;
|
||||
|
||||
assert_se(f = path_join(original_dir, *p));
|
||||
assert_se(l = path_join(original_dir, *ll));
|
||||
@ -197,7 +197,7 @@ TEST(copy_tree) {
|
||||
assert_se(copy_tree(original_dir, copy_dir, UID_INVALID, GID_INVALID, COPY_REFLINK|COPY_MERGE|COPY_HARDLINKS, denylist) == 0);
|
||||
|
||||
STRV_FOREACH(p, files) {
|
||||
_cleanup_free_ char *buf, *f, *c = NULL;
|
||||
_cleanup_free_ char *buf = NULL, *f = NULL, *c = NULL;
|
||||
size_t sz;
|
||||
int k;
|
||||
|
||||
@ -219,7 +219,7 @@ TEST(copy_tree) {
|
||||
}
|
||||
|
||||
STRV_FOREACH_PAIR(ll, p, symlinks) {
|
||||
_cleanup_free_ char *target, *f, *l;
|
||||
_cleanup_free_ char *target = NULL, *f = NULL, *l = NULL;
|
||||
|
||||
assert_se(f = strjoin(original_dir, *p));
|
||||
assert_se(l = strjoin(copy_dir, *ll));
|
||||
@ -229,7 +229,7 @@ TEST(copy_tree) {
|
||||
}
|
||||
|
||||
STRV_FOREACH_PAIR(ll, p, hardlinks) {
|
||||
_cleanup_free_ char *f, *l;
|
||||
_cleanup_free_ char *f = NULL, *l = NULL;
|
||||
struct stat a, b;
|
||||
|
||||
assert_se(f = strjoin(copy_dir, *p));
|
||||
|
@ -46,7 +46,7 @@ static void test_should_fail(const char *p) {
|
||||
}
|
||||
|
||||
static void test_one(const char *p) {
|
||||
_cleanup_free_ char *with_utc;
|
||||
_cleanup_free_ char *with_utc = NULL;
|
||||
|
||||
with_utc = strjoin(p, " UTC");
|
||||
test_should_pass(p);
|
||||
@ -54,7 +54,7 @@ static void test_one(const char *p) {
|
||||
}
|
||||
|
||||
static void test_one_noutc(const char *p) {
|
||||
_cleanup_free_ char *with_utc;
|
||||
_cleanup_free_ char *with_utc = NULL;
|
||||
|
||||
with_utc = strjoin(p, " UTC");
|
||||
test_should_pass(p);
|
||||
|
@ -75,7 +75,7 @@ TEST(ellipsize_mem) {
|
||||
}
|
||||
|
||||
static void test_ellipsize_one(const char *p) {
|
||||
_cleanup_free_ char *t;
|
||||
_cleanup_free_ char *t = NULL;
|
||||
t = ellipsize(p, columns(), 70);
|
||||
puts(t);
|
||||
free(t);
|
||||
|
@ -6,14 +6,14 @@
|
||||
#include "tests.h"
|
||||
|
||||
TEST(cescape) {
|
||||
_cleanup_free_ char *t;
|
||||
_cleanup_free_ char *t = NULL;
|
||||
|
||||
assert_se(t = cescape("abc\\\"\b\f\n\r\t\v\a\003\177\234\313"));
|
||||
assert_se(streq(t, "abc\\\\\\\"\\b\\f\\n\\r\\t\\v\\a\\003\\177\\234\\313"));
|
||||
}
|
||||
|
||||
TEST(xescape) {
|
||||
_cleanup_free_ char *t;
|
||||
_cleanup_free_ char *t = NULL;
|
||||
|
||||
assert_se(t = xescape("abc\\\"\b\f\n\r\t\v\a\003\177\234\313", ""));
|
||||
assert_se(streq(t, "abc\\x5c\"\\x08\\x0c\\x0a\\x0d\\x09\\x0b\\x07\\x03\\x7f\\x9c\\xcb"));
|
||||
@ -29,7 +29,7 @@ static void test_xescape_full_one(bool eight_bits) {
|
||||
log_info("/* %s */", __func__);
|
||||
|
||||
for (unsigned i = 0; i < 60; i++) {
|
||||
_cleanup_free_ char *t, *q;
|
||||
_cleanup_free_ char *t = NULL, *q = NULL;
|
||||
|
||||
assert_se(t = xescape_full("abc\\\"\b\f\n\r\t\v\a\003\177\234\313", "b", i, flags));
|
||||
|
||||
@ -65,7 +65,7 @@ TEST(test_xescape_full) {
|
||||
}
|
||||
|
||||
TEST(cunescape) {
|
||||
_cleanup_free_ char *unescaped;
|
||||
_cleanup_free_ char *unescaped = NULL;
|
||||
|
||||
assert_se(cunescape("abc\\\\\\\"\\b\\f\\a\\n\\r\\t\\v\\003\\177\\234\\313\\000\\x00", 0, &unescaped) < 0);
|
||||
assert_se(cunescape("abc\\\\\\\"\\b\\f\\a\\n\\r\\t\\v\\003\\177\\234\\313\\000\\x00", UNESCAPE_RELAX, &unescaped) >= 0);
|
||||
@ -132,7 +132,7 @@ TEST(cunescape) {
|
||||
}
|
||||
|
||||
static void test_shell_escape_one(const char *s, const char *bad, const char *expected) {
|
||||
_cleanup_free_ char *r;
|
||||
_cleanup_free_ char *r = NULL;
|
||||
|
||||
assert_se(r = shell_escape(s, bad));
|
||||
log_debug("%s → %s (expected %s)", s, r, expected);
|
||||
@ -203,7 +203,7 @@ TEST(shell_maybe_quote) {
|
||||
}
|
||||
|
||||
static void test_quote_command_line_one(char **argv, const char *expected) {
|
||||
_cleanup_free_ char *s;
|
||||
_cleanup_free_ char *s = NULL;
|
||||
|
||||
assert_se(s = quote_command_line(argv, SHELL_ESCAPE_EMPTY));
|
||||
log_info("%s", s);
|
||||
@ -224,7 +224,7 @@ TEST(quote_command_line) {
|
||||
}
|
||||
|
||||
static void test_octescape_one(const char *s, const char *expected) {
|
||||
_cleanup_free_ char *ret;
|
||||
_cleanup_free_ char *ret = NULL;
|
||||
|
||||
assert_se(ret = octescape(s, strlen_ptr(s)));
|
||||
log_debug("octescape(\"%s\") → \"%s\" (expected: \"%s\")", strnull(s), ret, expected);
|
||||
|
@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
static int run(int argc, char **argv) {
|
||||
_cleanup_close_ int fd;
|
||||
_cleanup_close_ int fd = -EBADF;
|
||||
char **args = strv_skip(argv, 1);
|
||||
int r;
|
||||
|
||||
|
@ -427,7 +427,7 @@ TEST(write_string_stream) {
|
||||
TEST(write_string_file) {
|
||||
_cleanup_(unlink_tempfilep) char fn[] = "/tmp/test-write_string_file-XXXXXX";
|
||||
char buf[64] = {};
|
||||
_cleanup_close_ int fd;
|
||||
_cleanup_close_ int fd = -EBADF;
|
||||
|
||||
fd = mkostemp_safe(fn);
|
||||
assert_se(fd >= 0);
|
||||
@ -440,7 +440,7 @@ TEST(write_string_file) {
|
||||
|
||||
TEST(write_string_file_no_create) {
|
||||
_cleanup_(unlink_tempfilep) char fn[] = "/tmp/test-write_string_file_no_create-XXXXXX";
|
||||
_cleanup_close_ int fd;
|
||||
_cleanup_close_ int fd = -EBADF;
|
||||
char buf[64] = {};
|
||||
|
||||
fd = mkostemp_safe(fn);
|
||||
|
@ -18,7 +18,7 @@ static void test_tokenizer_one(const char *data, ...) {
|
||||
void *state = NULL;
|
||||
va_list ap;
|
||||
|
||||
_cleanup_free_ char *cdata;
|
||||
_cleanup_free_ char *cdata = NULL;
|
||||
assert_se(cdata = cescape(data));
|
||||
log_info("/* %s data=\"%s\" */", __func__, cdata);
|
||||
|
||||
|
@ -449,7 +449,7 @@ static int parse_argv(int argc, char **argv,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_cleanup_free_ char *hostname;
|
||||
_cleanup_free_ char *hostname = NULL;
|
||||
assert_se(hostname = gethostname_malloc());
|
||||
assert_se(names = strv_new("localhost", "_gateway", "_outbound", "foo_no_such_host", hostname));
|
||||
|
||||
|
@ -21,7 +21,7 @@ TEST(parse_sleep_config) {
|
||||
|
||||
assert_se(parse_sleep_config(&sleep_config) == 0);
|
||||
|
||||
_cleanup_free_ char *sum, *sus, *him, *his, *hym, *hys;
|
||||
_cleanup_free_ char *sum = NULL, *sus = NULL, *him = NULL, *his = NULL, *hym = NULL, *hys = NULL;
|
||||
|
||||
sum = strv_join(sleep_config->modes[SLEEP_SUSPEND], ", ");
|
||||
sus = strv_join(sleep_config->states[SLEEP_SUSPEND], ", ");
|
||||
|
@ -13,8 +13,8 @@ static ssize_t add_string(struct strbuf *sb, const char *s) {
|
||||
}
|
||||
|
||||
TEST(strbuf) {
|
||||
_cleanup_(strbuf_freep) struct strbuf *sb;
|
||||
_cleanup_strv_free_ char **l;
|
||||
_cleanup_(strbuf_freep) struct strbuf *sb = NULL;
|
||||
_cleanup_strv_free_ char **l = NULL;
|
||||
ssize_t a, b, c, d, e, f, g, h;
|
||||
|
||||
sb = strbuf_new();
|
||||
|
@ -259,7 +259,7 @@ TEST(strextend_with_separator) {
|
||||
}
|
||||
|
||||
TEST(strrep) {
|
||||
_cleanup_free_ char *one, *three, *zero;
|
||||
_cleanup_free_ char *one = NULL, *three = NULL, *zero = NULL;
|
||||
one = strrep("waldo", 1);
|
||||
three = strrep("waldo", 3);
|
||||
zero = strrep("waldo", 0);
|
||||
|
@ -200,8 +200,8 @@ TEST(strv_join_full) {
|
||||
}
|
||||
|
||||
static void test_strv_unquote_one(const char *quoted, char **list) {
|
||||
_cleanup_strv_free_ char **s;
|
||||
_cleanup_free_ char *j;
|
||||
_cleanup_strv_free_ char **s = NULL;
|
||||
_cleanup_free_ char *j = NULL;
|
||||
unsigned i = 0;
|
||||
int r;
|
||||
|
||||
|
@ -240,7 +240,7 @@ TEST(format_timespan) {
|
||||
test_format_timespan_accuracy(USEC_PER_SEC);
|
||||
|
||||
/* See issue #23928. */
|
||||
_cleanup_free_ char *buf;
|
||||
_cleanup_free_ char *buf = NULL;
|
||||
assert_se(buf = new(char, 5));
|
||||
assert_se(buf == format_timespan(buf, 5, 100005, 1000));
|
||||
}
|
||||
|
@ -583,7 +583,7 @@ TEST(unit_name_to_instance) {
|
||||
}
|
||||
|
||||
TEST(unit_name_escape) {
|
||||
_cleanup_free_ char *r;
|
||||
_cleanup_free_ char *r = NULL;
|
||||
|
||||
r = unit_name_escape("ab+-c.a/bc@foo.service");
|
||||
assert_se(r);
|
||||
|
@ -99,7 +99,7 @@ TEST(utf8_encoded_valid_unichar) {
|
||||
}
|
||||
|
||||
TEST(utf8_escape_invalid) {
|
||||
_cleanup_free_ char *p1, *p2, *p3;
|
||||
_cleanup_free_ char *p1 = NULL, *p2 = NULL, *p3 = NULL;
|
||||
|
||||
p1 = utf8_escape_invalid("goo goo goo");
|
||||
log_debug("\"%s\"", p1);
|
||||
@ -115,7 +115,7 @@ TEST(utf8_escape_invalid) {
|
||||
}
|
||||
|
||||
TEST(utf8_escape_non_printable) {
|
||||
_cleanup_free_ char *p1, *p2, *p3, *p4, *p5, *p6;
|
||||
_cleanup_free_ char *p1 = NULL, *p2 = NULL, *p3 = NULL, *p4 = NULL, *p5 = NULL, *p6 = NULL;
|
||||
|
||||
p1 = utf8_escape_non_printable("goo goo goo");
|
||||
log_debug("\"%s\"", p1);
|
||||
@ -148,7 +148,7 @@ TEST(utf8_escape_non_printable_full) {
|
||||
"\001 \019\20\a", /* control characters */
|
||||
"\xef\xbf\x30\x13") /* misplaced continuation bytes followed by a digit and cc */
|
||||
for (size_t cw = 0; cw < 22; cw++) {
|
||||
_cleanup_free_ char *p, *q;
|
||||
_cleanup_free_ char *p = NULL, *q = NULL;
|
||||
size_t ew;
|
||||
|
||||
p = utf8_escape_non_printable_full(s, cw, false);
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "xdg-autostart-service.h"
|
||||
|
||||
TEST(translate_name) {
|
||||
_cleanup_free_ char *t;
|
||||
_cleanup_free_ char *t = NULL;
|
||||
|
||||
assert_se(t = xdg_autostart_service_translate_name("a-b.blub.desktop"));
|
||||
assert_se(streq(t, "app-a\\x2db.blub@autostart.service"));
|
||||
@ -26,7 +26,7 @@ static void test_xdg_format_exec_start_one(const char *exec, const char *expecte
|
||||
|
||||
TEST(xdg_format_exec_start) {
|
||||
_cleanup_free_ char *home = NULL;
|
||||
_cleanup_free_ char *expected1, *expected2 = NULL;
|
||||
_cleanup_free_ char *expected1 = NULL, *expected2 = NULL;
|
||||
|
||||
assert_se(get_home_dir(&home) >= 0);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user