-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix static scan issues #17
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,13 +164,13 @@ unsigned long long get_uptime(int refresh, int *error) | |
// Find system last kmsg from dropbox | ||
static int find_system_last_kmsg(char source[], int source_length) { | ||
struct dirent *entry; | ||
DIR *dir = opendir(DROPBOX_DIR); | ||
int file_exist = 0; | ||
|
||
if (source == NULL) { | ||
LOGE("source is NULL.\n"); | ||
return file_exist; | ||
} | ||
DIR *dir = opendir(DROPBOX_DIR); | ||
if (dir == NULL) { | ||
LOGE("No such directory: %s\n",DROPBOX_DIR); | ||
return file_exist; | ||
|
@@ -808,13 +808,17 @@ int process_info_and_error(char *filename, char *name) { | |
snprintf(path, sizeof(path),"%s/%s", filename,tmp_data_name); | ||
snprintf(destion,sizeof(destion),"%s/%s", dir, tmp_data_name); | ||
do_copy_tail(path, destion, 0); | ||
remove(path); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why need to check the return value of remove()? What's the consequence? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CID 206964: (#2 of 2): Unchecked return value from library (CHECKED_RETURN) |
||
if (remove(path) == -1) { | ||
LOGE("Failed to remove path %s\n", path); | ||
} | ||
} | ||
/*copy trigger file*/ | ||
snprintf(path, sizeof(path),"%s/%s", filename,name); | ||
snprintf(destion,sizeof(destion),"%s/%s", dir,name); | ||
do_copy_tail(path, destion, 0); | ||
remove(path); | ||
if (remove(path) == -1) { | ||
LOGE("Failed to remove path %s\n", path); | ||
} | ||
/*create type */ | ||
snprintf(tmp,sizeof(tmp),"%s",name); | ||
/*Set to upper case*/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,10 +88,11 @@ static inline int dir_exists(const char *dirpath) { | |
DIR * dir; | ||
|
||
dir = opendir(dirpath); | ||
if (dir != NULL) | ||
if (dir != NULL) { | ||
closedir(dirpath); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You may need to use { } for closedir and return 1. |
||
return 1; | ||
else | ||
return 0; | ||
} | ||
return 0; | ||
} | ||
|
||
static inline int get_file_size(char *filename) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why need to move opendir here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable dir going out of scope leaks the storage it points to at line 171.