diff options
Diffstat (limited to 'src/common/convert.c')
-rw-r--r-- | src/common/convert.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/common/convert.c b/src/common/convert.c index fc04db0..b139261 100644 --- a/src/common/convert.c +++ b/src/common/convert.c | |||
@@ -47,6 +47,8 @@ EXTRACTOR_common_convert_to_utf8 (const char *input, size_t len, const char *cha | |||
47 | return strdup (i); | 47 | return strdup (i); |
48 | tmpSize = 3 * len + 4; | 48 | tmpSize = 3 * len + 4; |
49 | tmp = malloc (tmpSize); | 49 | tmp = malloc (tmpSize); |
50 | if (tmp == NULL) | ||
51 | return NULL; | ||
50 | itmp = tmp; | 52 | itmp = tmp; |
51 | finSize = tmpSize; | 53 | finSize = tmpSize; |
52 | if (iconv (cd, (char **) &input, &len, &itmp, &finSize) == (size_t) - 1) | 54 | if (iconv (cd, (char **) &input, &len, &itmp, &finSize) == (size_t) - 1) |
@@ -56,6 +58,11 @@ EXTRACTOR_common_convert_to_utf8 (const char *input, size_t len, const char *cha | |||
56 | return strdup (i); | 58 | return strdup (i); |
57 | } | 59 | } |
58 | ret = malloc (tmpSize - finSize + 1); | 60 | ret = malloc (tmpSize - finSize + 1); |
61 | if (ret == NULL) | ||
62 | { | ||
63 | free (tmp); | ||
64 | return NULL; | ||
65 | } | ||
59 | memcpy (ret, tmp, tmpSize - finSize); | 66 | memcpy (ret, tmp, tmpSize - finSize); |
60 | ret[tmpSize - finSize] = '\0'; | 67 | ret[tmpSize - finSize] = '\0'; |
61 | free (tmp); | 68 | free (tmp); |