diff options
author | Daeheyon Jung <darrenh.jung@samsung.com> | 2017-12-12 16:53:22 +0900 |
---|---|---|
committer | Daeheyon Jung <darrenh.jung@samsung.com> | 2017-12-18 17:01:43 +0900 |
commit | 72c1b75d405995bd07d8f858b2ddb4dc1004663a (patch) | |
tree | 30443a2786f1d7ee1fcd1713bd271752279a45ee | |
parent | 5aa04c67c5f785599959b912b809f8db3425d63c (diff) | |
download | xdgmime-accepted/tizen_4.0_unified.tar.gz xdgmime-accepted/tizen_4.0_unified.tar.bz2 xdgmime-accepted/tizen_4.0_unified.zip |
Fix static analysis issuestizen_5.5.m2_releasetizen_4.0.IoT.p2_releasesubmit/tizen_5.5_wearable_hotfix/20201026.184303submit/tizen_5.5_mobile_hotfix/20201026.185103submit/tizen_5.5/20191031.000003submit/tizen_5.0/20181101.000003submit/tizen_4.0/20180104.013937submit/tizen/20180104.013833accepted/tizen/unified/20180105.065502accepted/tizen/5.5/unified/wearable/hotfix/20201027.114720accepted/tizen/5.5/unified/mobile/hotfix/20201027.085129accepted/tizen/5.5/unified/20191031.025534accepted/tizen/5.0/unified/20181102.020238accepted/tizen/4.0/unified/20180111.044152tizen_5.5_wearable_hotfixtizen_5.5_tvtizen_5.5_mobile_hotfixtizen_5.5tizen_5.0tizen_4.0_tvtizen_4.0accepted/tizen_5.5_unified_wearable_hotfixaccepted/tizen_5.5_unified_mobile_hotfixaccepted/tizen_5.5_unifiedaccepted/tizen_5.0_unifiedaccepted/tizen_4.0_unified
Change-Id: I923c1cea45956fad4f985d843b91e0f1b5f81de1
Signed-off-by: Daeheyon Jung <darrenh.jung@samsung.com>
-rw-r--r-- | xdgmime/src/xdgmime.c | 5 | ||||
-rw-r--r-- | xdgmime/src/xdgmimeglobs2.c | 4 | ||||
-rw-r--r-- | xdgmime/src/xdgmimemagic.c | 9 |
3 files changed, 14 insertions, 4 deletions
diff --git a/xdgmime/src/xdgmime.c b/xdgmime/src/xdgmime.c index 7f1dc9c..9e0e5e7 100644 --- a/xdgmime/src/xdgmime.c +++ b/xdgmime/src/xdgmime.c @@ -168,6 +168,11 @@ xdg_mime_init_from_directory (const char *directory) return FALSE; } + else + { + free(cache); + return TRUE; + } } } free (file_name); diff --git a/xdgmime/src/xdgmimeglobs2.c b/xdgmime/src/xdgmimeglobs2.c index e5ad349..00870e2 100644 --- a/xdgmime/src/xdgmimeglobs2.c +++ b/xdgmime/src/xdgmimeglobs2.c @@ -176,7 +176,7 @@ mime_type_info_list_add_file_name(mime_type_info_list *mtil, const char *mime_type, const char *file_name) { - if(!mtil) return; + if(!mtil || !mime_type || !file_name) return; mime_type_info **mti; int found = 0; @@ -248,6 +248,8 @@ mime_type_info_list_reload(mime_type_info_list *mtil) /* read globs2, and construct data structure */ globs2 = fopen(GLOBS2_PATH, "r"); + if (!globs2) return; + char *weight, *mime_type, *file_name, *saveptr = NULL; while(fgets(buf, 255, globs2)) { /* skip comment */ diff --git a/xdgmime/src/xdgmimemagic.c b/xdgmime/src/xdgmimemagic.c index fbc03af..7bd727c 100644 --- a/xdgmime/src/xdgmimemagic.c +++ b/xdgmime/src/xdgmimemagic.c @@ -240,7 +240,7 @@ _xdg_mime_magic_read_a_number (FILE *magic_file, errno = 0; retval = strtol (number_string, NULL, 10); - if ((retval < INT_MIN) || (retval > INT_MAX) || (errno != 0)) + if ((retval == LONG_MIN) || (retval == LONG_MAX) || (errno != 0)) return -1; } @@ -280,8 +280,12 @@ _xdg_mime_magic_parse_header (FILE *magic_file, XdgMimeMagicMatch *match) return XDG_MIME_MAGIC_ERROR; buffer = (char *)_xdg_mime_magic_read_to_newline (magic_file, &end_of_file); - if (end_of_file) + if (end_of_file) { + if (buffer) + free(buffer); + return XDG_MIME_MAGIC_EOF; + } end_ptr = buffer; while (*end_ptr != ']' && *end_ptr != '\000' && *end_ptr != '\n') @@ -791,7 +795,6 @@ _xdg_mime_magic_read_magic_file (XdgMimeMagic *mime_magic, case XDG_MIME_MAGIC_ERROR: state = _xdg_mime_magic_parse_error (magic_file); break; - case XDG_MIME_MAGIC_EOF: default: /* Make the compiler happy */ assert (0); |