office-gobmx/liblangtag/liblangtag-0.4.0-mac.patch
Tor Lillqvist 52e51f0fe7 Should not call lt_mem_add_ref() with a NULL pointer here either
Change-Id: I34f7ccca0fdfa71a53c2a80ae51178c5461b5640
2012-11-07 16:45:14 +02:00

126 lines
4.1 KiB
Diff

diff -r -u liblangtag-0.4.0.org/data/reg2xml.c liblangtag-0.4.0/data/reg2xml.c
--- misc/liblangtag-0.4.0.org/data/reg2xml.c 2012-11-06 09:15:59.000000000 -0600
+++ misc/build/liblangtag-0.4.0/data/reg2xml.c 2012-11-06 09:33:59.000000000 -0600
@@ -111,7 +111,9 @@
fsetpos(fp, &pos);
}
token = strstr(buffer, ": ");
- tag = strndup(buffer, token - buffer);
+ tag = malloc((token-buffer) + 1);
+ strncpy(tag, buffer, token-buffer);
+ tag[token-buffer] = 0;
token += 2;
xmlNewChild(ent, NULL,
(const xmlChar *)lt_strlower(tag),
diff -r -u liblangtag-0.4.0.org/liblangtag/lt-atomic.h liblangtag-0.4.0/liblangtag/lt-atomic.h
--- misc/liblangtag-0.4.0.org/liblangtag/lt-atomic.h 2012-11-06 09:15:59.000000000 -0600
+++ misc/build/liblangtag-0.4.0/liblangtag/lt-atomic.h 2012-11-06 09:24:15.000000000 -0600
@@ -93,7 +93,7 @@
{
lt_bool_t retval;
- lt_return_if_fail (v != NULL, FALSE);
+ lt_return_val_if_fail (v != NULL, FALSE);
pthread_mutex_lock(&__lt_atomic_lock);
retval = --(*v) == 0;
diff -r -u liblangtag-0.4.0.org/liblangtag/lt-error.c liblangtag-0.4.0/liblangtag/lt-error.c
--- misc/liblangtag-0.4.0.org/liblangtag/lt-error.c 2012-11-06 09:15:59.000000000 -0600
+++ misc/build/liblangtag-0.4.0/liblangtag/lt-error.c 2012-11-06 09:18:23.000000000 -0600
@@ -14,7 +14,6 @@
#include "config.h"
#endif
-#include <execinfo.h>
#include <stdlib.h>
#include "lt-list.h"
#include "lt-mem.h"
@@ -98,9 +97,7 @@
...)
{
va_list ap;
- void *traces[1024];
lt_error_data_t *d = lt_mem_alloc_object(sizeof (lt_error_data_t));
- int size;
lt_bool_t allocated;
lt_return_val_if_fail (error != NULL, NULL);
@@ -117,13 +114,9 @@
d->message = lt_strdup_vprintf(message, ap);
va_end(ap);
- size = backtrace(traces, 1024);
- if (size > 0)
- d->traces = backtrace_symbols(traces, size);
- d->stack_size = size;
+ d->stack_size = 0;
lt_mem_add_ref(&d->parent, d->message, free);
- lt_mem_add_ref(&d->parent, d->traces, free);
allocated = (*error)->data == NULL;
(*error)->data = lt_list_append((*error)->data, d, (lt_destroy_func_t)lt_mem_unref);
diff -r -u liblangtag-0.4.0.org/liblangtag/lt-ext-module.c liblangtag-0.4.0/liblangtag/lt-ext-module.c
--- misc/liblangtag-0.4.0.org/liblangtag/lt-ext-module.c 2012-11-06 09:15:59.000000000 -0600
+++ misc/build/liblangtag-0.4.0/liblangtag/lt-ext-module.c 2012-11-06 09:30:31.000000000 -0600
@@ -399,7 +399,8 @@
if (len > suffix_len &&
lt_strcmp0(&filename[prefix_len + len - suffix_len], "." LT_MODULE_SUFFIX) == 0) {
- module = strndup(&filename[prefix_len], len - suffix_len);
+ module = malloc((len-suffix_len) + 1);
+ strncpy(module, &filename[prefix_len], len-suffix_len);
module[len - suffix_len] = 0;
}
}
diff -r -u liblangtag-0.4.0.org/liblangtag/lt-messages.c liblangtag-0.4.0/liblangtag/lt-messages.c
--- misc/liblangtag-0.4.0.org/liblangtag/lt-messages.c 2012-11-06 09:15:59.000000000 -0600
+++ misc/build/liblangtag-0.4.0/liblangtag/lt-messages.c 2012-11-06 09:20:58.000000000 -0600
@@ -17,7 +17,6 @@
#include "config.h"
#endif
-#include <execinfo.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -98,27 +97,6 @@
static void
_lt_message_stacktrace(void)
{
- void *traces[1024];
- char **strings;
- int size, i;
-
- size = backtrace(traces, 1024);
- if (size > 0) {
- strings = backtrace_symbols(traces, size);
- lt_debug(LT_MSGCAT_TRACE, "Stacktrace:");
- /*
- * XXX:
- * 0.. here.
- * 1.. _lt_message_default_handler
- * 2.. lt_message_vprintf
- * 3.. lt_message_printf
- * 4.. lt_* macros
- */
- for (i = 4; i < size; i++) {
- lt_debug(LT_MSGCAT_TRACE, " %d. %s", i - 3, strings[i]);
- }
- free(strings);
- }
}
static void
diff -r -u liblangtag-0.4.0.org/liblangtag/lt-utils.c liblangtag-0.4.0/liblangtag/lt-utils.c
--- misc/liblangtag-0.4.0.org/liblangtag/lt-utils.c 2012-11-06 09:15:59.000000000 -0600
+++ misc/build/liblangtag-0.4.0/liblangtag/lt-utils.c 2012-11-06 09:23:36.000000000 -0600
@@ -14,6 +14,7 @@
#include "config.h"
#endif
+#include <stdlib.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>