summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-11-19 12:15:24 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-11-19 12:17:47 +0000
commitb14228fafb654fe7d8f8783475aa0c0ba87e4fea (patch)
tree797daef585eeca0688dc8c4e4b7911899b10269a /tools
parent9e6979b67afdd8122a29135d752c6ea84e9af6dc (diff)
intel-virtual-output: Check for failure to create a clone
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tools')
-rw-r--r--tools/virtual.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/tools/virtual.c b/tools/virtual.c
index ab4f12b6..2d5a4e45 100644
--- a/tools/virtual.c
+++ b/tools/virtual.c
@@ -2005,6 +2005,9 @@ static int last_display_add_clones__randr(struct context *ctx)
struct clone *clone = add_clone(ctx);
RROutput id;
+ if (clone == NULL)
+ return -ENOMEM;
+
clone->depth = 24;
clone->next = display->clone;
display->clone = clone;
@@ -2073,6 +2076,9 @@ static int last_display_add_clones__xinerama(struct context *ctx)
struct clone *clone = add_clone(ctx);
RROutput id;
+ if (clone == NULL)
+ return -ENOMEM;
+
if (xi[n].width == 0 || xi[n].height == 0)
continue;
@@ -2130,14 +2136,18 @@ static int last_display_add_clones__xinerama(struct context *ctx)
static int last_display_add_clones__display(struct context *ctx)
{
struct display *display = last_display(ctx);
- struct clone *clone = add_clone(ctx);
Display *dpy = display->dpy;
+ struct clone *clone;
Screen *scr;
char buf[80];
int ret;
RROutput id;
- DBG(("%s(%s)\n", __func__, DisplayString(display->dpy)));
+
+ DBG(("%s(%s)\n", __func__, DisplayString(dpy)));
+ clone = add_clone(ctx);
+ if (clone == NULL)
+ return -ENOMEM;
clone->depth = 24;
clone->next = display->clone;
@@ -2166,7 +2176,7 @@ static int last_display_add_clones__display(struct context *ctx)
ret = clone_init_depth(clone);
if (ret) {
fprintf(stderr, "Failed to negotiate image format for display \"%s\"\n",
- DisplayString(display->dpy));
+ DisplayString(dpy));
return ret;
}
@@ -2180,7 +2190,7 @@ static int last_display_add_clones__display(struct context *ctx)
ret = clone_update_modes__fixed(clone);
if (ret) {
fprintf(stderr, "Failed to clone display \"%s\"\n",
- DisplayString(display->dpy));
+ DisplayString(dpy));
return ret;
}