Resolve build crash for openSUSE_12.1

OBS-URL: https://build.opensuse.org/package/show/X11:Wayland/wayland?expand=0&rev=7
This commit is contained in:
Jan Engelhardt 2012-10-22 20:28:04 +00:00 committed by Git OBS Bridge
parent 5da0c58ee5
commit 0c574da87f
2 changed files with 64 additions and 1 deletions

View File

@ -0,0 +1,59 @@
From 1bade73b6b58cf2c3187b0fca72f4aec8301c4a3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= <krh@bitplanet.net>
Date: Sat, 20 Oct 2012 11:38:57 -0400
Subject: [PATCH] scanner: Fix valgrind errors
---
src/scanner.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/scanner.c b/src/scanner.c
index d0aafec..4a4e605 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -393,6 +393,8 @@ start_element(void *data, const char *element_name, const char **atts)
case OBJECT:
if (interface_name)
arg->interface_name = strdup(interface_name);
+ else
+ arg->interface_name = NULL;
break;
default:
if (interface_name != NULL)
@@ -449,10 +451,7 @@ start_element(void *data, const char *element_name, const char **atts)
fail(ctx, "description without summary");
description = malloc(sizeof *description);
- if (summary)
- description->summary = strdup(summary);
- else
- description->summary = NULL;
+ description->summary = strdup(summary);
if (ctx->message)
ctx->message->description = description;
@@ -476,10 +475,9 @@ end_element(void *data, const XML_Char *name)
strndup(ctx->character_data,
ctx->character_data_length);
} else if (strcmp(name, "description") == 0) {
- char *text = strndup(ctx->character_data,
- ctx->character_data_length);
- if (text)
- ctx->description->text = text;
+ ctx->description->text =
+ strndup(ctx->character_data,
+ ctx->character_data_length);
ctx->description = NULL;
} else if (strcmp(name, "request") == 0 ||
strcmp(name, "event") == 0) {
@@ -1147,6 +1145,7 @@ int main(int argc, char *argv[])
protocol.type_index = 0;
protocol.null_run_length = 0;
protocol.copyright = NULL;
+ memset(&ctx, 0, sizeof ctx);
ctx.protocol = &protocol;
ctx.filename = "<stdin>";
--
1.7.10.4

View File

@ -26,6 +26,7 @@ URL: http://wayland.freedesktop.org/
#Git-Clone: git://anongit.freedesktop.org/wayland/wayland
#Git-Web: http://cgit.freedesktop.org/wayland/wayland/
Source: %name-%version.tar.xz
Patch1: 0001-scanner-Fix-valgrind-errors.patch
BuildRoot: %_tmppath/%name-%version-build
BuildRequires: autoconf >= 2.64
BuildRequires: automake >= 1.11
@ -95,9 +96,12 @@ to develop applications that require these.
%prep
%setup -q
%patch -P 1 -p1
%build
autoreconf -fi
if [ ! -e configure ]; then
autoreconf -fi;
fi;
%configure --disable-static
make %{?_smp_mflags}