Plug minor leaks in string conversion routines.
This commit is contained in:
parent
ddf261432a
commit
d5613905c8
|
@ -47,6 +47,7 @@ char *convert_ucs_to_utf8(char *input) {
|
|||
/* Convert our text */
|
||||
int rc = iconv(conversion_descriptor, (void*)&input, &input_size, &output, &output_size);
|
||||
if (rc == (size_t)-1) {
|
||||
free(buffer);
|
||||
perror("Converting to UCS-2 failed");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -85,6 +86,7 @@ char *convert_utf8_to_ucs2(char *input, int *real_strlen) {
|
|||
int rc = iconv(conversion_descriptor2, (void*)&input, &input_size, &output, &output_size);
|
||||
if (rc == (size_t)-1) {
|
||||
perror("Converting to UCS-2 failed");
|
||||
free(buffer);
|
||||
if (real_strlen != NULL)
|
||||
*real_strlen = 0;
|
||||
return NULL;
|
||||
|
|
|
@ -49,6 +49,7 @@ char *convert_ucs_to_utf8(char *input) {
|
|||
int rc = iconv(conversion_descriptor, (void*)&input, &input_size, &output, &output_size);
|
||||
if (rc == (size_t)-1) {
|
||||
perror("Converting to UCS-2 failed");
|
||||
free(buffer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -88,6 +89,7 @@ char *convert_utf8_to_ucs2(char *input, int *real_strlen) {
|
|||
int rc = iconv(conversion_descriptor2, (void*)&input, &input_size, &output, &output_size);
|
||||
if (rc == (size_t)-1) {
|
||||
perror("Converting to UCS-2 failed");
|
||||
free(buffer);
|
||||
if (real_strlen != NULL)
|
||||
*real_strlen = 0;
|
||||
return NULL;
|
||||
|
|
|
@ -153,6 +153,7 @@ char *convert_utf8_to_ucs2(char *input, int *real_strlen) {
|
|||
int rc = iconv(conversion_descriptor, (void*)&input, &input_size, &output, &output_size);
|
||||
if (rc == (size_t)-1) {
|
||||
perror("Converting to UCS-2 failed");
|
||||
FREE(buffer);
|
||||
if (real_strlen != NULL)
|
||||
*real_strlen = 0;
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in New Issue