-
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
Fix static scan issues #17
Conversation
@@ -89,6 +89,7 @@ static inline int dir_exists(const char *dirpath) { | |||
|
|||
dir = opendir(dirpath); | |||
if (dir != NULL) | |||
closedir(dirpath); |
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.
You may need to use { } for closedir and return 1.
int file_exist = 0; | ||
|
||
if (source == NULL) { | ||
LOGE("source is NULL.\n"); | ||
return file_exist; | ||
} | ||
DIR *dir = opendir(DROPBOX_DIR); |
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.
@@ -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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
CID 206964: (#2 of 2): Unchecked return value from library (CHECKED_RETURN)
5. check_return Calling remove(path) without checking return value. This library function may fail and return an error code. [Note: The source code implementation of the function has been overridden by a builtin model.]
crashlog/usercrash.c
Outdated
LOGE("Failed to remove path %s\n", path); | ||
free(key); | ||
free(dir); | ||
return -1; |
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.
If you return here, other code logic may not be executed like raise_event.
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.
Ok, just check return value and print some logs
039d4b9
to
5c4e945
Compare
Tracked-On: OAM-110031 Signed-off-by: Zheng, XianjunX <[email protected]>
5c4e945
to
702833e
Compare
Android CI has started Engineering Build for this issue ,Please check the linked Tracked-On issue/Android CI Web for more details. |
1 similar comment
Android CI has started Engineering Build for this issue ,Please check the linked Tracked-On issue/Android CI Web for more details. |
FAILURE: Android CI has completed Engineering Build for this issue.Please check the linked Tracked-On issue/Android CI Web for more details. |
Android CI has started Engineering Build for this issue ,Please check the linked Tracked-On issue/Android CI Web for more details. |
FAILURE: Android CI has completed Engineering Build for this issue.Please check the linked Tracked-On issue/Android CI Web for more details. |
1 similar comment
FAILURE: Android CI has completed Engineering Build for this issue.Please check the linked Tracked-On issue/Android CI Web for more details. |
Android CI has started Engineering Build for this issue ,Please check the linked Tracked-On issue/Android CI Web for more details. |
FAILURE: Android CI has completed Engineering Build for this issue.Please check the linked Tracked-On issue/Android CI Web for more details. |
Android CI has started Engineering Build for this issue ,Please check the linked Tracked-On issue/Android CI Web for more details. |
Android CI has started Engineering Build for this issue ,Please check the linked Tracked-On issue/Android CI Web for more details. |
SUCCESS: Android CI has completed Engineering Build for this issue.Please check the linked Tracked-On issue/Android CI Web for more details. |
Android CI has started MERGE Build for this pr ,Please check the linked Tracked-On issue/Android CI Web for more details. |
Android CI has completed MERGE Build for this pr, build is FAILURE. Please check the linked Tracked-On issue/Android CI Web for more details. |
Android CI has started Engineering Build for this issue ,Please check the linked Tracked-On issue/Android CI Web for more details. |
Android CI has started Engineering Build for this issue ,Please check the linked Tracked-On issue/Android CI Web for more details. |
7 similar comments
Android CI has started Engineering Build for this issue ,Please check the linked Tracked-On issue/Android CI Web for more details. |
Android CI has started Engineering Build for this issue ,Please check the linked Tracked-On issue/Android CI Web for more details. |
Android CI has started Engineering Build for this issue ,Please check the linked Tracked-On issue/Android CI Web for more details. |
Android CI has started Engineering Build for this issue ,Please check the linked Tracked-On issue/Android CI Web for more details. |
Android CI has started Engineering Build for this issue ,Please check the linked Tracked-On issue/Android CI Web for more details. |
Android CI has started Engineering Build for this issue ,Please check the linked Tracked-On issue/Android CI Web for more details. |
Android CI has started Engineering Build for this issue ,Please check the linked Tracked-On issue/Android CI Web for more details. |
SUCCESS: Android CI has completed Engineering Build for this issue.Please check the linked Tracked-On issue/Android CI Web for more details. |
8 similar comments
SUCCESS: Android CI has completed Engineering Build for this issue.Please check the linked Tracked-On issue/Android CI Web for more details. |
SUCCESS: Android CI has completed Engineering Build for this issue.Please check the linked Tracked-On issue/Android CI Web for more details. |
SUCCESS: Android CI has completed Engineering Build for this issue.Please check the linked Tracked-On issue/Android CI Web for more details. |
SUCCESS: Android CI has completed Engineering Build for this issue.Please check the linked Tracked-On issue/Android CI Web for more details. |
SUCCESS: Android CI has completed Engineering Build for this issue.Please check the linked Tracked-On issue/Android CI Web for more details. |
SUCCESS: Android CI has completed Engineering Build for this issue.Please check the linked Tracked-On issue/Android CI Web for more details. |
SUCCESS: Android CI has completed Engineering Build for this issue.Please check the linked Tracked-On issue/Android CI Web for more details. |
SUCCESS: Android CI has completed Engineering Build for this issue.Please check the linked Tracked-On issue/Android CI Web for more details. |
Android CI has started MERGE Build for this pr ,Please check the linked Tracked-On issue/Android CI Web for more details. |
Android CI has completed MERGE Build for this pr, build is FAILURE. Please check the linked Tracked-On issue/Android CI Web for more details. |
Android CI has started MERGE Build for this pr ,Please check the linked Tracked-On issue/Android CI Web for more details. |
a55a5d1
into
projectceladon:celadon/s/mr0/apollo
Android CI has completed MERGE Build for this pr, build is SUCCESS. Please check the linked Tracked-On issue/Android CI Web for more details. For Binaries: /cactus-absp-or-local/celadon_smr0_apollo-merge/79 |
Tracked-On: OAM-110031