diff options
| author | Hiroshi Inoue | 2016-02-27 02:23:23 +0000 |
|---|---|---|
| committer | Hiroshi Inoue | 2016-02-27 11:20:10 +0000 |
| commit | 4d44165af04d40e8aad405a9fbe31d7304c654c8 (patch) | |
| tree | f38cc46822b8fc56ff8fd578713dc6783e528c93 /setup.c | |
| parent | 4f45057a6ad848938e34eea278feba9ca0eaa0e5 (diff) | |
Fix NULL dereferences which causes application crash. Patch by Tsunakawa, Takayuki.
Diffstat (limited to 'setup.c')
| -rw-r--r-- | setup.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -486,12 +486,18 @@ cleanup: tlen = strlen(emsg); wermsg = (SQLWCHAR *) malloc(sizeof(SQLWCHAR) * (tlen + 1)); - ulen = utf8_to_ucs2_lf(emsg, SQL_NTS, FALSE, wermsg, tlen + 1, TRUE); + if (wermsg) + ulen = utf8_to_ucs2_lf(emsg, SQL_NTS, FALSE, wermsg, tlen + 1, TRUE); + else + ulen = (SQLULEN) -1; if (ulen != (SQLULEN) -1) { allocstr = malloc(4 * tlen + 1); - (void) wstrtomsg(wermsg, (int) tlen, allocstr, (int) (4 * tlen + 1)); - emsg = allocstr; + if (allocstr) + { + (void) wstrtomsg(wermsg, (int) tlen, allocstr, (int) (4 * tlen + 1)); + emsg = allocstr; + } } #endif /* UNICODE_SUPPORT */ |
