Browse Source

Fixed clang static analyzer issues

merge-experiment
Hoa V. DINH 7 years ago
parent
commit
705023bc1e
20 changed files with 80 additions and 16 deletions
  1. +3
    -7
      build-mac/libetpan.xcodeproj/project.pbxproj
  2. +10
    -1
      build-mac/libetpan.xcodeproj/xcshareddata/xcschemes/libetpan ios.xcscheme
  3. +10
    -1
      build-mac/libetpan.xcodeproj/xcshareddata/xcschemes/libetpan.xcscheme
  4. +10
    -1
      build-mac/libetpan.xcodeproj/xcshareddata/xcschemes/static libetpan.xcscheme
  5. +1
    -1
      src/data-types/mailstream_compress.c
  6. +3
    -0
      src/driver/implementation/imap/imapdriver.c
  7. +3
    -1
      src/driver/implementation/imap/imapdriver_message.c
  8. +4
    -0
      src/driver/implementation/imap/imapdriver_tools.c
  9. +3
    -0
      src/driver/implementation/maildir/maildirdriver.c
  10. +1
    -0
      src/driver/implementation/mime-message/mime_message_driver.c
  11. +1
    -0
      src/driver/implementation/pop3/pop3driver.c
  12. +3
    -0
      src/driver/implementation/pop3/pop3driver_cached.c
  13. +1
    -1
      src/engine/mailprivacy_gnupg.c
  14. +1
    -0
      src/low-level/imap/condstore.c
  15. +4
    -2
      src/low-level/imap/qresync.c
  16. +1
    -0
      src/low-level/imf/mailimf.c
  17. +1
    -0
      src/low-level/mh/mailmh.c
  18. +12
    -0
      src/low-level/mime/mailmime_write_generic.c
  19. +3
    -0
      src/low-level/nntp/newsnntp.c
  20. +5
    -1
      src/low-level/pop3/mailpop3.c

+ 3
- 7
build-mac/libetpan.xcodeproj/project.pbxproj View File

@ -1802,7 +1802,7 @@
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0450;
LastUpgradeCheck = 0600;
};
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "libetpan" */;
compatibilityVersion = "Xcode 3.2";
@ -2471,7 +2471,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
DYLIB_COMPATIBILITY_VERSION = 1;
@ -2492,7 +2491,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
COMBINE_HIDPI_IMAGES = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 1;
@ -2511,9 +2509,9 @@
1DEB91B208733DA50010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
@ -2531,8 +2529,8 @@
1DEB91B308733DA50010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
@ -2580,7 +2578,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_MODEL_TUNING = G5;
@ -2605,7 +2602,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_MODEL_TUNING = G5;


+ 10
- 1
build-mac/libetpan.xcodeproj/xcshareddata/xcschemes/libetpan ios.xcscheme View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0450"
LastUpgradeVersion = "0600"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -39,6 +39,15 @@
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C682E21815B315EF00BE9DA7"
BuildableName = "libetpan-ios.a"
BlueprintName = "libetpan ios"
ReferencedContainer = "container:libetpan.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>


+ 10
- 1
build-mac/libetpan.xcodeproj/xcshareddata/xcschemes/libetpan.xcscheme View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0450"
LastUpgradeVersion = "0600"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -39,6 +39,15 @@
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8DC2EF4F0486A6940098B216"
BuildableName = "libetpan.framework"
BlueprintName = "libetpan"
ReferencedContainer = "container:libetpan.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>


+ 10
- 1
build-mac/libetpan.xcodeproj/xcshareddata/xcschemes/static libetpan.xcscheme View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0450"
LastUpgradeVersion = "0600"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -39,6 +39,15 @@
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C69AB10910546FE500F32FBD"
BuildableName = "libetpan.a"
BlueprintName = "static libetpan"
ReferencedContainer = "container:libetpan.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>


+ 1
- 1
src/data-types/mailstream_compress.c View File

@ -99,7 +99,7 @@ mailstream_low * mailstream_low_compress_open(mailstream_low * ms)
mailstream_low * s;
/* stores the original mailstream */
struct mailstream_compress_data * compress_data = malloc(sizeof(* compress_data));
struct mailstream_compress_data * compress_data = calloc(1, sizeof(* compress_data));
if (compress_data == NULL)
goto err;


+ 3
- 0
src/driver/implementation/imap/imapdriver.c View File

@ -686,6 +686,9 @@ static int imapdriver_unseen_number(mailsession * session, const char * mb,
uint32_t unseen;
int r;
messages = 0;
recent = 0;
unseen = 0;
r = imapdriver_status_folder(session, mb, &messages, &recent, &unseen);
if (r != MAIL_NO_ERROR)
return r;


+ 3
- 1
src/driver/implementation/imap/imapdriver_message.c View File

@ -1086,7 +1086,9 @@ static int imap_fetch_section_body(mailmessage * msg_info,
mailimap_fetch_att_free(fetch_att);
return MAIL_ERROR_MEMORY;
}
text = NULL;
text_length = 0;
r = fetch_imap(msg_info, fetch_type, &text, &text_length);
mailimap_fetch_type_free(fetch_type);


+ 4
- 0
src/driver/implementation/imap/imapdriver_tools.c View File

@ -2991,6 +2991,10 @@ int imap_msg_list_to_imap_set(clist * msg_list,
}
pindex = clist_content(cur);
if (pindex == NULL) {
// Make clang static analyzer happy.
break;
}
if (!previous_valid) {
first_seq = * pindex;


+ 3
- 0
src/driver/implementation/maildir/maildirdriver.c View File

@ -353,6 +353,9 @@ static int recent_number(mailsession * session, const char * mb,
uint32_t unseen;
int r;
messages = 0;
recent = 0;
unseen = 0;
r = status_folder(session, mb, &messages, &recent, &unseen);
if (r != MAIL_NO_ERROR)
return r;


+ 1
- 0
src/driver/implementation/mime-message/mime_message_driver.c View File

@ -471,6 +471,7 @@ static int fetch_size(mailmessage * msg_info,
char * msg;
int r;
msg = NULL;
r = fetch(msg_info, &msg, result);
if (r != MAIL_NO_ERROR) {
return r;


+ 1
- 0
src/driver/implementation/pop3/pop3driver.c View File

@ -306,6 +306,7 @@ static int pop3driver_status_folder(mailsession * session, const char * mb,
uint32_t count;
int r;
count = 0;
r = pop3driver_messages_number(session, mb, &count);
if (r != MAIL_NO_ERROR)
return r;


+ 3
- 0
src/driver/implementation/pop3/pop3driver_cached.c View File

@ -598,6 +598,9 @@ static int pop3driver_cached_unseen_number(mailsession * session,
uint32_t unseen;
int r;
messages = 0;
recent = 0;
unseen = 0;
r = pop3driver_cached_status_folder(session, mb,
&messages, &recent, &unseen);
if (r != MAIL_NO_ERROR)


+ 1
- 1
src/engine/mailprivacy_gnupg.c View File

@ -1717,7 +1717,7 @@ static int collect_recipient(char * recipient, size_t size,
int res;
* recipient = '\0';
remaining = size;
remaining = size - 1;
mailimf_single_fields_init(&single_fields, fields);


+ 1
- 0
src/low-level/imap/condstore.c View File

@ -926,6 +926,7 @@ static int
struct mailimap_condstore_search * search_data;
struct mailimap_extension_data * ext_data;
search_data = NULL;
r = search_data_parse(fd, buffer, &cur_token, &search_data);
if (r != MAILIMAP_NO_ERROR)
return r;


+ 4
- 2
src/low-level/imap/qresync.c View File

@ -304,8 +304,10 @@ int mailimap_select_qresync(mailimap * session, const char * mb,
if (* fetch_result != NULL) {
mailimap_fetch_list_free(* fetch_result);
}
if (* p_vanished != NULL) {
mailimap_qresync_vanished_free(* p_vanished);
if (p_vanished != NULL) {
if (* p_vanished != NULL) {
mailimap_qresync_vanished_free(* p_vanished);
}
}
return MAILIMAP_ERROR_SELECT;
}


+ 1
- 0
src/low-level/imf/mailimf.c View File

@ -6379,6 +6379,7 @@ mailimf_resent_bcc_parse(const char * message, size_t length,
goto err;
}
addr_list = NULL;
r = mailimf_address_list_parse(message, length, &cur_token, &addr_list);
if ((r != MAILIMF_NO_ERROR) && (r != MAILIMF_ERROR_PARSE)) {
res = r;


+ 1
- 0
src/low-level/mh/mailmh.c View File

@ -833,6 +833,7 @@ int mailmh_folder_remove_message(struct mailmh_folder * folder,
chashdatum key;
chashdatum data;
filename = NULL;
r = mailmh_folder_get_message_filename(folder, indx, &filename);
if (filename == NULL) {
res = r;


+ 12
- 0
src/low-level/mime/mailmime_write_generic.c View File

@ -859,6 +859,12 @@ static int mailmime_part_write_driver(int (* do_write)(void *, const char *, siz
goto free_boundary;
}
if (boundary == NULL) {
// Make clang static analyzer happy.
res = MAILIMF_ERROR_MEMORY;
goto free_boundary;
}
r = mailimf_string_write_driver(do_write, data, col, boundary, strlen(boundary));
if (r != MAILIMF_NO_ERROR) {
res = r;
@ -890,6 +896,12 @@ static int mailmime_part_write_driver(int (* do_write)(void *, const char *, siz
goto free_boundary;
}
if (boundary == NULL) {
// Make clang static analyzer happy.
res = MAILIMF_ERROR_MEMORY;
goto free_boundary;
}
r = mailimf_string_write_driver(do_write, data, col, boundary, strlen(boundary));
if (r != MAILIMF_NO_ERROR) {
res = r;


+ 3
- 0
src/low-level/nntp/newsnntp.c View File

@ -1362,6 +1362,9 @@ int newsnntp_date(newsnntp * f, struct tm * tm)
return NEWSNNTP_ERROR_STREAM;
r = parse_response(f, response);
if (f->nntp_response == NULL) {
return NEWSNNTP_ERROR_UNEXPECTED_RESPONSE;
}
switch (r) {
case 111:


+ 5
- 1
src/low-level/pop3/mailpop3.c View File

@ -1558,7 +1558,11 @@ int mailpop3_auth(mailpop3 * f, const char * auth_type,
int got_response;
got_response = 1;
if (* f->pop3_response == '\0')
if (f->pop3_response == NULL) {
// Make clang static analyzer happy.
got_response = 0;
}
else if (* f->pop3_response == '\0')
got_response = 0;
if (got_response) {


Loading…
Cancel
Save