Found 86 issues misc/dbginfo.c:14: error: DEAD_STORE The value written to &argspec is never used. 12. { 13. size_t i; 14. > char *argspec = NULL; 15. char *retspec = NULL; 16. misc/dbginfo.c:15: error: DEAD_STORE The value written to &retspec is never used. 13. size_t i; 14. char *argspec = NULL; 15. > char *retspec = NULL; 16. 17. /* TODO: print enum definitions */ cmds/script.c:27: error: DEAD_STORE The value written to &sym is never used. 25. struct uftrace_record *rstack = task->rstack; 26. struct uftrace_session_link *sessions = &handle->sessions; 27. > struct uftrace_symbol *sym = NULL; 28. char *symname = NULL; 29. cmds/script.c:28: error: DEAD_STORE The value written to &symname is never used. 26. struct uftrace_session_link *sessions = &handle->sessions; 27. struct uftrace_symbol *sym = NULL; 28. > char *symname = NULL; 29. 30. sym = task_find_sym(sessions, task, rstack); misc/symbols.c:43: error: MEMORY_LEAK memory dynamically allocated to `opts->dirname` by call to `strdup()` at line 43, column 20 is not reachable after line 43, column 4. 41. switch (key) { 42. case 'd': 43. > opts->dirname = xstrdup(optarg); 44. break; 45. utils/argspec.c:173: error: DEAD_STORE The value written to &suffix is never used. 171. *next = '\0'; 172. 173. > reg = arch_register_number(setting->arch, ++suffix); 174. if (reg >= 0) { 175. arg->struct_regs[arg->struct_reg_cnt++] = reg; libmcount/event.c:56: error: DEAD_STORE The value written to &ret is never used. 54. struct uftrace_elf_iter iter; 55. bool found_sdt = false; 56. > int ret = -1; 57. 58. if (name[0] == '\0') utils/graph.c:62: error: DEAD_STORE The value written to &node is never used. 60. struct uftrace_dbg_loc *loc) 61. { 62. > struct uftrace_graph_node *node = NULL; 63. struct uftrace_graph_node *curr = tg->node; 64. struct uftrace_fstack *fstack; utils/graph.c:105: error: DEAD_STORE The value written to &type is never used. 103. struct uftrace_symbol *sym; 104. struct uftrace_special_node *snode; 105. > enum uftrace_graph_node_type type = NODE_T_NORMAL; 106. 107. sym = find_symtabs(&sess->sym_info, fstack->addr); utils/auto-args.c:108: error: MEMORY_LEAK memory dynamically allocated to `entry.end` by call to `strdup()` at line 97, column 30 is not reachable after line 108, column 3. 106. entry.name = demangle(name); 107. 108. > add_auto_args(root, &entry, &tr); 109. 110. next: utils/dwarf.c:89: error: DEAD_STORE The value written to &parent is never used. 87. { 88. struct debug_entry *iter; 89. > struct rb_node *parent = NULL; 90. struct rb_node **p = &root->rb_node; 91. int ret; utils/kernel.c:90: error: DEAD_STORE The value written to &ret is never used. 88. static int set_tracing_depth(struct uftrace_kernel_writer *kernel) 89. { 90. > int ret = 0; 91. char buf[32]; 92. utils/auto-args.c:122: error: DEAD_STORE The value written to &parent is never used. 120. static struct uftrace_filter *find_auto_args(struct rb_root *root, char *name) 121. { 122. > struct rb_node *parent = NULL; 123. struct rb_node **p = &root->rb_node; 124. struct uftrace_filter *iter; cmds/report.c:126: error: DEAD_STORE The value written to &sym is never used. 124. { 125. struct uftrace_session_link *sessions = &handle->sessions; 126. > struct uftrace_symbol *sym = NULL; 127. struct uftrace_record *rstack; 128. struct uftrace_task_reader *task; utils/filter.c:147: error: DEAD_STORE The value written to &parent is never used. 145. struct uftrace_trigger *tr) 146. { 147. > struct rb_node *parent = NULL; 148. struct rb_node **p = &root->rb_node; 149. struct uftrace_filter *iter; cmds/record.c:163: error: MEMORY_LEAK memory dynamically allocated to `envbuf` by call to `strdup()` at line 162, column 13 is not reachable after line 163, column 4. 161. if (envbuf) { 162. envbuf = xstrdup(envbuf); 163. > libpath = strjoin(envbuf, INSTALL_LIB_PATH, ":"); 164. setenv("LD_LIBRARY_PATH", libpath, 1); 165. free(libpath); utils/fstack.c:176: error: MEMORY_LEAK memory dynamically allocated to `filter_tids` by call to `realloc()` at line 176, column 17 is not reachable after line 176, column 17. 174. id = strtol(p, &p, 10); 175. 176. > filter_tids = xrealloc(filter_tids, (nr_filters + 1) * sizeof(int)); 177. filter_tids[nr_filters++] = id; 178. cmds/live.c:177: error: MEMORY_LEAK memory dynamically allocated to `envbuf` by call to `strdup()` at line 176, column 13 is not reachable after line 177, column 4. 175. if (envbuf) { 176. envbuf = xstrdup(envbuf); 177. > libpath = strjoin(envbuf, INSTALL_LIB_PATH, ":"); 178. setenv("LD_LIBRARY_PATH", libpath, 1); 179. free(libpath); cmds/dump.c:257: error: DEAD_STORE The value written to &end is never used. 255. goto out; 256. } 257. > *end++ = '\0'; 258. 259. pr_out("%s session of task %d: %.*s (%s)\n", timestamp, tid, 16, sid, utils/kernel.c:211: error: MEMORY_LEAK memory dynamically allocated to `patt.patt` by call to `init_filter_pattern()` at line 206, column 3 is not reachable after line 211, column 4. 209. add_single_filter(head, name); 210. else 211. > add_pattern_filter(head, &patt); 212. 213. free_filter_pattern(&patt); utils/session.c:267: error: DEAD_STORE The value written to &parent is never used. 265. struct uftrace_session *iter; 266. struct uftrace_session *s = NULL; 267. > struct rb_node *parent = NULL; 268. struct rb_node **p = &sessions->root.rb_node; 269. utils/kernel.c:293: error: MEMORY_LEAK memory dynamically allocated to `patt.patt` by call to `init_filter_pattern()` at line 288, column 3 is not reachable after line 293, column 4. 291. add_single_event(events, name); 292. else 293. > add_pattern_event(events, &patt); 294. 295. free_filter_pattern(&patt); utils/dwarf.c:303: error: RESOURCE_LEAK resource acquired by call to `open()` at line 291, column 7 is not released after line 303, column 3. 301. dinfo->dwfl = dwfl_begin(&dwfl_callbacks); 302. if (dinfo->dwfl == NULL) { 303. > pr_dbg2("failed to begin libdwfl: %s\n", dwfl_errmsg(dwfl_errno())); 304. return -1; 305. } cmds/replay.c:308: error: DEAD_STORE The value written to &sym is never used. 306. struct uftrace_record *rstack = task->rstack; 307. struct uftrace_session_link *sessions = &task->h->sessions; 308. > struct uftrace_symbol *sym = NULL; 309. char *name; 310. struct uftrace_fstack *fstack; utils/data-file.c:354: error: DEAD_STORE The value written to &saved_errno is never used. 352. FILE *fp; 353. char buf[PATH_MAX]; 354. > int saved_errno = 0; 355. struct stat stbuf; 356. utils/data-file.c:398: error: DEAD_STORE The value written to &saved_errno is never used. 396. return -saved_errno; 397. ok: 398. > saved_errno = 0; 399. handle->fp = fp; 400. handle->dirname = opts->dirname; cmds/recv.c:380: error: RESOURCE_LEAK resource acquired to `fd` by call to `open()` at line 366, column 7 is not released after line 380, column 2. 378. pr_err("write client data failed on %s", buf); 379. 380. > close(fd); 381. } 382. uftrace.c:394: error: MEMORY_LEAK memory dynamically allocated by call to `strdup()` at line 394, column 20 is not reachable after line 394, column 2. 392. static char *opt_add_prefix_string(char *old_opt, char *prefix, char *new_opt) 393. { 394. > new_opt = strjoin(xstrdup(prefix), new_opt, ""); 395. 396. if (old_opt) { cmds/replay.c:411: error: DEAD_STORE The value written to &str is never used. 409. { 410. int i = 0, n = 0; 411. > char *str = NULL; 412. 413. const int null_str = -1; libmcount/dynamic.c:438: error: DEAD_STORE The value written to &delim is never used. 436. else { 437. *delim = '\0'; 438. > pl->module = xstrdup(++delim); 439. } 440. cmds/live.c:480: error: QUANDARY_TAINT_ERROR EnvironmentVariable(getenv at line 80, column 16) -> ShellExec(execvp at line 53, column 3). 478. 479. if (opts->use_pager) 480. > start_pager(setup_pager()); 481. 482. pr_dbg("live-record finished.. \n"); utils/auto-args.c:485: error: DEAD_STORE The value written to &parent is never used. 483. struct enum_def *find_enum_def(struct rb_root *root, char *name) 484. { 485. > struct rb_node *parent = NULL; 486. struct rb_node **p = &root->rb_node; 487. struct enum_def *iter; cmds/recv.c:495: error: DEAD_STORE The value written to &filename is never used. 493. struct client_data *client; 494. int32_t namelen; 495. > char *filename = NULL; 496. void *filedata; 497. utils/fstack.c:540: error: DEAD_STORE The value written to &or is never used. 538. if (opts->loc_filter) { 539. pr_out("%s%s", or, opts->loc_filter); 540. > or = " or "; 541. } 542. pr_out("\n"); cmds/tui.c:522: error: DEAD_STORE The value written to &sym is never used. 520. struct uftrace_graph *graph; 521. struct tui_graph_node *graph_node; 522. > struct uftrace_symbol *sym = NULL; 523. char *name; 524. uint64_t addr = rec->addr; cmds/graph.c:528: error: DEAD_STORE The value written to &sym is never used. 526. { 527. struct task_graph *tg; 528. > struct uftrace_symbol *sym = NULL; 529. char *name; 530. struct uftrace_dbg_loc *loc = NULL; uftrace.c:562: error: DEAD_STORE The value written to &dp is never used. 560. static bool is_libmcount_directory(const char *path) 561. { 562. > DIR *dp = NULL; 563. struct dirent *ent; 564. int ret = false; uftrace.c:687: error: MEMORY_LEAK memory dynamically allocated by call to `strv_append()` at line 686, column 3 is not reachable after line 687, column 3. 685. /* add time-filter to uftrace.data/default.opts */ 686. strv_append(&default_opts, "-t"); 687. > strv_append(&default_opts, arg); 688. 689. opts->threshold = parse_time(arg, 3); utils/session.c:607: error: DEAD_STORE The value written to &parent is never used. 605. { 606. struct uftrace_task *t; 607. > struct rb_node *parent = NULL; 608. struct rb_node **p = &sessions->tasks.rb_node; 609. libmcount/dynamic.c:660: error: DEAD_STORE The value written to &ret is never used. 658. enum uftrace_pattern_type ptype) 659. { 660. > int ret = 0; 661. char *size_filter; 662. bool needs_modules = !!strchr(patch_funcs, '@'); utils/session.c:663: error: DEAD_STORE The value written to &sym is never used. 661. struct uftrace_session *sess; 662. struct uftrace_sym_info *sinfo; 663. > struct uftrace_symbol *sym = NULL; 664. uint64_t addr = rec->addr; 665. cmds/dump.c:680: error: DEAD_STORE The value written to ×tamp is never used. 678. if (raw->kbuf_offset == 0x18) { 679. uint64_t offset = 0x10; 680. > uint64_t timestamp = 0; 681. void *data = __kparser_read_offset(kp, cpu, offset); 682. unsigned char *tmp = data - 12; /* data still returns next record */ cmds/record.c:709: error: DEAD_STORE The value written to &check_list is never used. 707. while (!buf_done) { 708. LIST_HEAD(head); 709. > bool check_list = false; 710. 711. check_list = handle_pollfd(pollfd, warg, true, has_perf_event, opts->kernel, 1000); utils/session.c:700: error: DEAD_STORE The value written to &sym is never used. 698. { 699. struct uftrace_session *sess; 700. > struct uftrace_symbol *sym = NULL; 701. 702. sess = find_task_session(sessions, task->t, time); cmds/replay.c:724: error: DEAD_STORE The value written to &loc is never used. 722. char *libname = ""; 723. struct uftrace_mmap *map = NULL; 724. > struct uftrace_dbg_loc *loc = NULL; 725. char *str_loc = NULL; 726. cmds/replay.c:723: error: DEAD_STORE The value written to &map is never used. 721. char args[1024]; 722. char *libname = ""; 723. > struct uftrace_mmap *map = NULL; 724. struct uftrace_dbg_loc *loc = NULL; 725. char *str_loc = NULL; cmds/replay.c:718: error: DEAD_STORE The value written to &sym is never used. 716. struct uftrace_record *rstack; 717. struct uftrace_session_link *sessions = &handle->sessions; 718. > struct uftrace_symbol *sym = NULL; 719. enum uftrace_argspec_string_bits str_mode = 0; 720. char *symname = NULL; cmds/replay.c:720: error: DEAD_STORE The value written to &symname is never used. 718. struct uftrace_symbol *sym = NULL; 719. enum uftrace_argspec_string_bits str_mode = 0; 720. > char *symname = NULL; 721. char args[1024]; 722. char *libname = ""; utils/auto-args.c:726: error: USE_AFTER_FREE pointer `str` last assigned on line 724 was freed by call to `free()` at line 726, column 3 and is dereferenced or freed at line 726, column 3. 724. str = get_enum_def_string(e_def); 725. save_debug_file(fp, 'E', e_def->name, (long)str); 726. > free(str); 727. 728. node = rb_next(node); utils/symbol.c:736: error: DEAD_STORE The value written to &ret is never used. 734. unsigned long offset, unsigned long flags) 735. { 736. > int ret = -1; 737. int count = 0; 738. struct uftrace_elf_data elf; utils/session.c:744: error: DEAD_STORE The value written to &sym is never used. 742. { 743. struct uftrace_session *sess; 744. > struct uftrace_symbol *sym = NULL; 745. struct uftrace_mmap *map; 746. struct uftrace_dbg_info *dinfo; utils/filter.c:751: error: DEAD_STORE The value written to &pos is never used. 749. { 750. struct strv acts = STRV_INIT; 751. > char *pos = NULL; 752. int j; 753. libmcount/mcount.c:780: error: MEMORY_LEAK memory dynamically allocated to `mtd.rstack` by call to `malloc()` at line 777, column 17 is not reachable after line 780, column 2. 778. 779. pthread_once(&once_control, mcount_init_file); 780. > prepare_shmem_buffer(mtdp); 781. 782. pthread_setspecific(mtd_key, mtdp); utils/dwarf.c:762: error: DEAD_STORE The value written to ¶m_class is never used. 760. { 761. Dwarf_Die child; 762. > int param_class = PARAM_CLASS_NONE; 763. struct param_data pd; 764. int i, reg_cnt = 0, fp_cnt = 0; utils/utils.c:867: error: DEAD_STORE The value written to &argn is never used. 865. char **argv = NULL; 866. char *cmd_dup = NULL; 867. > int argn = 0; 868. 869. if (!cmd || !*cmd) utils/utils.c:865: error: DEAD_STORE The value written to &argv is never used. 863. char **parse_cmdline(char *cmd, int *argc) 864. { 865. > char **argv = NULL; 866. char *cmd_dup = NULL; 867. int argn = 0; utils/utils.c:866: error: DEAD_STORE The value written to &cmd_dup is never used. 864. { 865. char **argv = NULL; 866. > char *cmd_dup = NULL; 867. int argn = 0; 868. cmds/record.c:893: error: USE_AFTER_FREE pointer `buf` last assigned on line 892 was freed by call to `free()` at line 897, column 3 and is dereferenced or freed at line 893, column 3. 891. while (!list_empty(&buf_write_list)) { 892. buf = list_first_entry(&buf_write_list, struct buf_list, list); 893. > write_buffer(buf, opts, sock); 894. munmap(buf->shmem_buf, opts->bufsize); 895. libmcount/plthook.c:1008: error: DEAD_STORE The value written to &ret_addr is never used. 1006. struct mcount_ret_stack *rstack; 1007. unsigned long *ret_loc; 1008. > unsigned long ret_addr = 0; 1009. 1010. mtdp = get_thread_data(); libmcount/plthook.c:1026: error: NULL_DEREFERENCE pointer `rstack` last assigned on line 1024 could be null and is dereferenced at line 1026, column 6. 1024. rstack = restore_vfork(mtdp, NULL); /* FIXME! */ 1025. 1026. > if (unlikely(rstack->flags & (MCOUNT_FL_LONGJMP | MCOUNT_FL_VFORK))) { 1027. if (rstack->flags & MCOUNT_FL_LONGJMP) { 1028. update_pltgot(mtdp, rstack->pd, rstack->dyn_idx); libmcount/record.c:1200: error: DEAD_STORE The value written to &prev_ino is never used. 1198. prev_map = map; 1199. prev_off = off; 1200. > prev_ino = ino; 1201. prev_major = major; 1202. prev_minor = minor; libmcount/record.c:1201: error: DEAD_STORE The value written to &prev_major is never used. 1199. prev_off = off; 1200. prev_ino = ino; 1201. > prev_major = major; 1202. prev_minor = minor; 1203. prev_written = false; libmcount/record.c:1202: error: DEAD_STORE The value written to &prev_minor is never used. 1200. prev_ino = ino; 1201. prev_major = major; 1202. > prev_minor = minor; 1203. prev_written = false; 1204. } libmcount/record.c:1199: error: DEAD_STORE The value written to &prev_off is never used. 1197. map->next = NULL; 1198. prev_map = map; 1199. > prev_off = off; 1200. prev_ino = ino; 1201. prev_major = major; libmcount/record.c:1182: error: DEAD_STORE The value written to &prev_written is never used. 1180. write_map(ofp, prev_map, prev_major, prev_minor, prev_ino, 1181. prev_off); 1182. > prev_written = true; 1183. } 1184. } utils/symbol.c:1373: error: DEAD_STORE The value written to &ret is never used. 1371. FILE *ifp, *ofp; 1372. ssize_t len; 1373. > int ret = 0; 1374. 1375. xasprintf(&symfile, "%s/kallsyms", dirname); cmds/dump.c:1463: error: DEAD_STORE The value written to &sym is never used. 1461. int tid = kernel->tids[i]; 1462. int losts = kparser_missed_events(&kernel->parser, i); 1463. > struct uftrace_symbol *sym = NULL; 1464. char *name; 1465. uint64_t addr; uftrace.c:1432: error: QUANDARY_TAINT_ERROR EnvironmentVariable(getenv at line 80, column 16) -> ShellExec(execvp at line 53, column 3). 1430. case -3: 1431. if (opts.use_pager) 1432. > start_pager(setup_pager()); 1433. pr_out(uftrace_usage); 1434. pr_out(uftrace_help); uftrace.c:1509: error: QUANDARY_TAINT_ERROR EnvironmentVariable(getenv at line 80, column 16) -> ShellExec(execvp at line 53, column 3). 1507. /* 'live' will start pager at its replay time */ 1508. if (opts.use_pager && opts.mode != UFTRACE_MODE_LIVE) 1509. > start_pager(pager); 1510. 1511. /* the srcline info is used for TUI status line by default */ utils/dwarf.c:1652: error: DEAD_STORE The value written to &prev is never used. 1650. struct rb_node *rbnode; 1651. struct comp_dir_entry *e; 1652. > struct comp_dir_entry *prev = NULL; 1653. struct comp_dir_entry *max; 1654. utils/dwarf.c:1701: error: MEMORY_LEAK memory dynamically allocated by call to `init_filter_pattern()` at line 1701, column 3 is not reachable after line 1701, column 3. 1699. arg_patt = xcalloc(args->nr, sizeof(*arg_patt)); 1700. strv_for_each(args, s, i) 1701. > init_filter_pattern(ptype, &arg_patt[i], s); 1702. 1703. ret_patt = xcalloc(rets->nr, sizeof(*ret_patt)); cmds/tui.c:1854: error: DEAD_STORE The value written to &curr_sess is never used. 1852. struct tui_list_node *curr = node; 1853. struct uftrace_session *s = curr->data; 1854. > struct uftrace_session *curr_sess = NULL; 1855. int count = 0; 1856. cmds/tui.c:1859: error: DEAD_STORE The value written to &len is never used. 1857. switch ((long)s) { 1858. case TUI_SESS_REPORT: 1859. > print_buf(" R Report functions"); 1860. break; 1861. case TUI_SESS_INFO: cmds/tui.c:1862: error: DEAD_STORE The value written to &len is never used. 1860. break; 1861. case TUI_SESS_INFO: 1862. > print_buf(" I uftrace Info"); 1863. break; 1864. case TUI_SESS_HELP: cmds/tui.c:1865: error: DEAD_STORE The value written to &len is never used. 1863. break; 1864. case TUI_SESS_HELP: 1865. > print_buf(" h Help message"); 1866. break; 1867. case TUI_SESS_QUIT: cmds/tui.c:1868: error: DEAD_STORE The value written to &len is never used. 1866. break; 1867. case TUI_SESS_QUIT: 1868. > print_buf(" q quit"); 1869. break; 1870. default: cmds/tui.c:1873: error: DEAD_STORE The value written to &len is never used. 1871. curr_sess = partial_graph.ug.sess; 1872. get_current_graph(node, &count); 1873. > print_buf(" %c %s #%d: %s", s == curr_sess ? 'G' : ' ', "call Graph for session", 1874. count, basename(s->exename)); 1875. break; utils/fstack.c:2038: error: DEAD_STORE The value written to &cpu is never used. 2036. static int find_rstack_cpu(struct uftrace_kernel_reader *kernel, struct uftrace_record *rstack) 2037. { 2038. > int cpu = -1; 2039. 2040. if (rstack->type == UFTRACE_LOST) { cmds/record.c:2115: error: RESOURCE_LEAK resource acquired to `wd.pipefd` by call to `open()` at line 2106, column 14 is not released after line 2115, column 2. 2113. pr_out("uftrace: install signal handlers to task %d\n", pid); 2114. 2115. > setup_writers(&wd, opts); 2116. start_tracing(&wd, opts, ready[1]); 2117. close(ready[1]); cmds/tui.c:2086: error: DEAD_STORE The value written to &count is never used. 2084. { 2085. void *prev = win->ops->sibling_prev(win, win->curr); 2086. > int count = 0; 2087. 2088. if (prev == NULL) cmds/tui.c:2113: error: DEAD_STORE The value written to &count is never used. 2111. { 2112. void *next = win->ops->sibling_next(win, win->curr); 2113. > int count = 0; 2114. 2115. if (next == NULL) utils/fstack.c:2168: error: DEAD_STORE The value written to &perf is never used. 2166. { 2167. struct uftrace_data *handle = task->h; 2168. > struct uftrace_perf_reader *perf = NULL; 2169. 2170. read_perf_data(handle); cmds/tui.c:2471: error: MEMORY_LEAK memory dynamically allocated by call to `strv_append()` at line 2470, column 3 is not reachable after line 2471, column 3. 2469. snprintf(buf, sizeof(buf), "+%d", dloc->line); 2470. strv_append(&editor_strv, buf); 2471. > strv_append(&editor_strv, dloc->file->name); 2472. } 2473. else { cmds/tui.c:2489: error: QUANDARY_TAINT_ERROR EnvironmentVariable(getenv at line 2442, column 23) -> ShellExec(execvp at line 2489, column 3). 2487. 2488. if (pid == 0) { 2489. > execvp(editor_strv.p[0], editor_strv.p); 2490. exit(1); 2491. } cmds/tui.c:2719: error: DEAD_STORE The value written to &num_sort_key is never used. 2717. void *old_top; 2718. enum tui_mode tui_mode; 2719. > int num_sort_key = 3; 2720. 2721. graph = tui_graph_init(opts); cmds/tui.c:2796: error: DEAD_STORE The value written to &tui_mode is never used. 2794. break; 2795. case TUI_SESS_QUIT: 2796. > tui_mode = TUI_MODE_OTHER; 2797. goto out; 2798. default: Summary of the reports DEAD_STORE: 64 MEMORY_LEAK: 12 QUANDARY_TAINT_ERROR: 4 RESOURCE_LEAK: 3 USE_AFTER_FREE: 2 NULL_DEREFERENCE: 1