fix a couple of issues found with llvm-analyze
This commit is contained in:
parent
c269cec334
commit
64825d3c58
|
@ -312,6 +312,8 @@ int setup_namespace(
|
||||||
goto undo_mounts;
|
goto undo_mounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(paths);
|
||||||
|
|
||||||
t = old_root_dir + sizeof(root_dir) - 1;
|
t = old_root_dir + sizeof(root_dir) - 1;
|
||||||
if (umount2(t, MNT_DETACH) < 0)
|
if (umount2(t, MNT_DETACH) < 0)
|
||||||
/* At this point it's too late to turn anything back,
|
/* At this point it's too late to turn anything back,
|
||||||
|
|
|
@ -374,8 +374,8 @@ int main(int argc, char *argv[]) {
|
||||||
if (startswith(p, "luks-"))
|
if (startswith(p, "luks-"))
|
||||||
p += 5;
|
p += 5;
|
||||||
|
|
||||||
name = strappend("luks-", *i);
|
name = strappend("luks-", p);
|
||||||
device = strappend("UUID=", *i);
|
device = strappend("UUID=", p);
|
||||||
|
|
||||||
if (!name || !device) {
|
if (!name || !device) {
|
||||||
log_oom();
|
log_oom();
|
||||||
|
|
|
@ -788,7 +788,7 @@ static int journal_file_append_data(
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!compressed)
|
if (!compressed && size > 0)
|
||||||
memcpy(o->data.payload, data, size);
|
memcpy(o->data.payload, data, size);
|
||||||
|
|
||||||
r = journal_file_link_data(f, o, p, hash);
|
r = journal_file_link_data(f, o, p, hash);
|
||||||
|
@ -1057,7 +1057,8 @@ int journal_file_append_entry(JournalFile *f, const dual_timestamp *ts, const st
|
||||||
ts->monotonic < le64toh(f->header->tail_entry_monotonic))
|
ts->monotonic < le64toh(f->header->tail_entry_monotonic))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
items = alloca(sizeof(EntryItem) * n_iovec);
|
/* alloca() can't take 0, hence let's allocate at least one */
|
||||||
|
items = alloca(sizeof(EntryItem) * MAX(1, n_iovec));
|
||||||
|
|
||||||
for (i = 0; i < n_iovec; i++) {
|
for (i = 0; i < n_iovec; i++) {
|
||||||
uint64_t p;
|
uint64_t p;
|
||||||
|
@ -2336,7 +2337,8 @@ int journal_directory_vacuum(const char *directory, uint64_t max_use, uint64_t m
|
||||||
n_list ++;
|
n_list ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
qsort(list, n_list, sizeof(struct vacuum_info), vacuum_compare);
|
if (n_list > 0)
|
||||||
|
qsort(list, n_list, sizeof(struct vacuum_info), vacuum_compare);
|
||||||
|
|
||||||
for(i = 0; i < n_list; i++) {
|
for(i = 0; i < n_list; i++) {
|
||||||
struct statvfs ss;
|
struct statvfs ss;
|
||||||
|
|
|
@ -186,6 +186,7 @@ struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char *
|
||||||
if (list->entries == NULL) {
|
if (list->entries == NULL) {
|
||||||
free(entry->name);
|
free(entry->name);
|
||||||
free(entry->value);
|
free(entry->value);
|
||||||
|
free(entry);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
list->entries_max += add;
|
list->entries_max += add;
|
||||||
|
|
|
@ -135,11 +135,11 @@ int main_analyze(const char *pack_path) {
|
||||||
printf("\nHOST: %s"
|
printf("\nHOST: %s"
|
||||||
"TYPE: %c\n"
|
"TYPE: %c\n"
|
||||||
"MISSING: %d\n"
|
"MISSING: %d\n"
|
||||||
"TOTAL: %ld\n",
|
"TOTAL: %llu\n",
|
||||||
line,
|
line,
|
||||||
a,
|
a,
|
||||||
missing,
|
missing,
|
||||||
tsize);
|
(unsigned long long) tsize);
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
|
||||||
|
|
|
@ -273,6 +273,7 @@ finish:
|
||||||
free(message);
|
free(message);
|
||||||
free(monotonic);
|
free(monotonic);
|
||||||
free(realtime);
|
free(realtime);
|
||||||
|
free(priority);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,7 +275,7 @@ char *ascii_filter(const char *str) {
|
||||||
if (!r)
|
if (!r)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (s = r, d = r; *s; s++)
|
for (s = str, d = r; *s; s++)
|
||||||
if ((unsigned char) *s < 128)
|
if ((unsigned char) *s < 128)
|
||||||
*(d++) = *s;
|
*(d++) = *s;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue