diff options
author | Bryce W. Harrington <b.harrington@samsung.com> | 2014-01-14 21:58:32 +0000 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2014-01-17 11:29:54 -0800 |
commit | 3abdafd12d67c2effa239c8e30415c24c162ec12 (patch) | |
tree | cdf19a2bdacae95068a81a9a5ef56bca9a858872 /clients | |
parent | ad0704a22695649def5c1846f8326b231472e8e4 (diff) | |
download | weston-3abdafd12d67c2effa239c8e30415c24c162ec12.tar.gz |
terminal: Only set title if asprintf succeeded
Handles potential out of memory situation by skipping the title update.
This fixes the following warning:
terminal.c: In function ‘resize_handler’:
terminal.c:851:11: warning: ignoring return value of ‘asprintf’,
declared with attribute warn_unused_result [-Wunused-result]
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Diffstat (limited to 'clients')
-rw-r--r-- | clients/terminal.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/clients/terminal.c b/clients/terminal.c index e2a6236c..09bc3215 100644 --- a/clients/terminal.c +++ b/clients/terminal.c @@ -848,9 +848,10 @@ resize_handler(struct widget *widget, width = columns * terminal->average_width + m; height = rows * terminal->extents.height + m; widget_set_size(terminal->widget, width, height); - asprintf(&p, "%s — [%dx%d]", terminal->title, columns, rows); - window_set_title(terminal->window, p); - free(p); + if (asprintf(&p, "%s — [%dx%d]", terminal->title, columns, rows) > 0) { + window_set_title(terminal->window, p); + free(p); + } } terminal_resize_cells(terminal, columns, rows); |