diff options
author | TingPing <tingping@tingping.se> | 2014-12-28 06:37:25 -0500 |
---|---|---|
committer | TingPing <tingping@tingping.se> | 2014-12-28 06:44:44 -0500 |
commit | 83032b1aa3c3e5910c5cfd3e0ea1d25827f56475 (patch) | |
tree | 9be32a04d3070eac82177e11d182dad40a63baa7 /src/common/ssl.c | |
parent | c4cb1b25ec06a5b0cb718c6f8e74630df9a9bc64 (diff) |
Use glib for all allocations
- Removes need to check for malloc failure - Removes need for NULL checks on free - Adds checks for integer overflows - Removes some extra memset calls - Removes chance of mixing libc and glib malloc/free
Diffstat (limited to 'src/common/ssl.c')
-rw-r--r-- | src/common/ssl.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/common/ssl.c b/src/common/ssl.c index 26fbc1ba..78c3c510 100644 --- a/src/common/ssl.c +++ b/src/common/ssl.c @@ -504,9 +504,7 @@ _SSL_check_common_name (X509 *cert, const char *host) if (common_name_len < 0) return -1; - common_name = calloc (common_name_len + 1, 1); - if (common_name == NULL) - return -1; + common_name = g_malloc0 (common_name_len + 1); X509_NAME_get_text_by_NID (name, NID_commonName, common_name, common_name_len + 1); @@ -535,7 +533,7 @@ _SSL_check_common_name (X509 *cert, const char *host) rv = 0; out: - free(common_name); + g_free(common_name); return rv; } |