summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/reg2xml.c5
-rw-r--r--liblangtag/lt-error.c7
-rw-r--r--liblangtag/lt-ext-module.c1
-rw-r--r--liblangtag/lt-extension.c1
-rw-r--r--liblangtag/lt-string.c11
-rw-r--r--liblangtag/lt-tag.c4
6 files changed, 19 insertions, 10 deletions
diff --git a/data/reg2xml.c b/data/reg2xml.c
index cffab86..b6a8da3 100644
--- a/data/reg2xml.c
+++ b/data/reg2xml.c
@@ -145,7 +145,10 @@ _parse(const char *filename,
goto multiline;
} else {
buffer[len] = 0;
- fsetpos(fp, &pos);
+ if (fsetpos(fp, &pos) == -1) {
+ lt_critical("Unable to parse mutliple line");
+ return FALSE;
+ }
}
token = strstr(buffer, ": ");
tag = lt_strndup(buffer, token - buffer);
diff --git a/liblangtag/lt-error.c b/liblangtag/lt-error.c
index 167be74..afd0e5f 100644
--- a/liblangtag/lt-error.c
+++ b/liblangtag/lt-error.c
@@ -113,18 +113,21 @@ lt_error_set(lt_error_t **error,
#if HAVE_BACKTRACE
void *traces[1024];
#endif
- lt_error_data_t *d = lt_mem_alloc_object(sizeof (lt_error_data_t));
+ lt_error_data_t *d;
int size = 0;
lt_bool_t allocated;
lt_return_val_if_fail (error != NULL, NULL);
+ d = lt_mem_alloc_object(sizeof (lt_error_data_t));
if (!d)
goto bail0;
if (!*error)
*error = lt_error_new();
- if (!*error)
+ if (!*error) {
+ lt_mem_unref(d);
goto bail0;
+ }
d->type = type;
va_start(ap, message);
diff --git a/liblangtag/lt-ext-module.c b/liblangtag/lt-ext-module.c
index 49ae62a..b5c931f 100644
--- a/liblangtag/lt-ext-module.c
+++ b/liblangtag/lt-ext-module.c
@@ -453,6 +453,7 @@ lt_ext_module_lookup(char singleton_c)
int singleton = lt_ext_module_singleton_char_to_int(singleton_c);
lt_return_val_if_fail (singleton >= 0, NULL);
+ lt_return_val_if_fail (signleton < LT_MAX_EXT_MODULES, NULL);
lt_return_val_if_fail (__lt_ext_module_initialized, NULL);
if (!__lt_ext_modules[singleton])
diff --git a/liblangtag/lt-extension.c b/liblangtag/lt-extension.c
index 9bb4fc9..221081b 100644
--- a/liblangtag/lt-extension.c
+++ b/liblangtag/lt-extension.c
@@ -87,6 +87,7 @@ lt_extension_add_singleton(lt_extension_t *extension,
lt_return_val_if_fail (singleton_c != 'X' && singleton_c != 'x', FALSE);
lt_return_val_if_fail (!lt_extension_has_singleton(extension, singleton_c), FALSE);
lt_return_val_if_fail (singleton >= 0, FALSE);
+ lt_return_val_if_fail (singleton < LT_MAX_EXT_MODULES, FALSE);
m = lt_ext_module_lookup(singleton_c);
d = lt_ext_module_create_data(m);
diff --git a/liblangtag/lt-string.c b/liblangtag/lt-string.c
index b94a085..7ae1b80 100644
--- a/liblangtag/lt-string.c
+++ b/liblangtag/lt-string.c
@@ -144,11 +144,13 @@ lt_string_free(lt_string_t *string,
{
char *retval = NULL;
- if (!free_segment) {
- lt_mem_remove_ref(&string->parent, string->string);
- retval = string->string;
+ if (string) {
+ if (!free_segment) {
+ lt_mem_remove_ref(&string->parent, string->string);
+ retval = string->string;
+ }
+ lt_string_unref(string);
}
- lt_string_unref(string);
return retval;
}
@@ -313,6 +315,7 @@ lt_string_append_filename(lt_string_t *string,
lt_string_append(string, p);
p = (const char *)va_arg(ap, const char *);
}
+ va_end(ap);
return string;
}
diff --git a/liblangtag/lt-tag.c b/liblangtag/lt-tag.c
index 77b3b82..b717015 100644
--- a/liblangtag/lt-tag.c
+++ b/liblangtag/lt-tag.c
@@ -1600,8 +1600,6 @@ lt_tag_canonicalize(lt_tag_t *tag,
if (tag_string == NULL || tag_string[0] == 0)
break;
- if (r)
- lt_redundant_unref(r);
r = lt_redundant_db_lookup(rdb, tag_string);
if (r) {
const char *preferred = lt_redundant_get_preferred_tag(r);
@@ -1891,7 +1889,7 @@ lt_tag_compare(const lt_tag_t *v1,
lt_variant_t *vv1, *vv2;
vv1 = l1 ? lt_list_value(l1) : NULL;
- vv2 = l2 ? lt_list_value(l2) : NULL;
+ vv2 = lt_list_value(l2);
retval &= lt_variant_compare(vv1, vv2);
l1 = lt_list_next(l1);
l2 = lt_list_next(l2);