johnmehr / gitup

A minimalist, dependency-free FreeBSD program to clone/pull Git repositories.
BSD 2-Clause "Simplified" License
50 stars 9 forks source link

Warnings reported by clang static analyzer #97

Closed emaste closed 11 months ago

emaste commented 1 year ago

I ran clang's static analyzer and it produced a number of warnings. I've added the "dead assignment" ones to #95 as they're the same sort of issue.

To reproduce install llvm15 and run scan-build15 make followed by scan-view15 <path reported from scan-build> I have not checked that there are no false positives.

Unused code Dead assignment gitup.c apply_deltas 2495 1 View Report Report Bug Open File
Unused code Dead assignment gitup.c unpack_objects 2339 1 View Report Report Bug Open File
Unused code Dead assignment gitup.c main 4075 1 View Report Report Bug Open File
Unused code Dead assignment gitup.c extract_command_line_want 3686 1 View Report Report Bug Open File
Unused code Dead nested assignment gitup.c main 4103 1 View Report Report Bug Open File
Unused code Dead nested assignment gitup.c load_object 1140 1 View Report Report Bug Open File
Logic error Dereference of undefined pointer value gitup.c Tree_Local_Path_RB_INSERT_COLOR 259 26 View Report Report Bug Open File
Logic error Dereference of undefined pointer value gitup.c Tree_Local_Hash_RB_INSERT_COLOR 263 44 View Report Report Bug Open File
Logic error Dereference of undefined pointer value gitup.c Tree_Remote_Path_RB_INSERT_COLOR 255 43 View Report Report Bug Open File
Logic error Dereference of undefined pointer value gitup.c Tree_Objects_RB_INSERT_COLOR 267 26 View Report Report Bug Open File
Logic error Dereference of undefined pointer value gitup.c Tree_Trim_Path_RB_INSERT_COLOR 271 26 View Report Report Bug Open File
Memory error Memory leak gitup.c main 3851 24 View Report Report Bug Open File
Memory error Memory leak gitup.c load_gitignore 3648 83 View Report Report Bug Open File
Memory error Memory leak gitup.c load_remote_data 986 19 View Report Report Bug Open File
Memory error Memory leak gitup.c main 3851 26 View Report Report Bug Open File
Memory error Memory leak gitup.c trim_path 658 31 View Report Report Bug Open File
Memory error Memory leak gitup.c process_tree 2839 31 View Report Report Bug Open File
Memory error Memory leak gitup.c build_repair_command 1793 82 View Report Report Bug Open File
Memory error Memory leak gitup.c load_config 3431 39 View Report Report Bug Open File
Memory error Memory leak gitup.c scan_local_repository 1049 15 View Report Report Bug Open File
Logic error Uninitialized argument value gitup.c object_node_compare 220 79 View Report Report Bug Open File
Logic error Unix API gitup.c file_node_compare_path 206 28 View Report Report Bug Open File
Logic error Unix API gitup.c apply_deltas 2553 89 View Report Report Bug Open File
johnmehr commented 1 year ago

I'll keep digging but it looks like the remaining six issues are false positives. Thanks!