lkml.org 
[lkml]   [2014]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/1] Consistently use xrealloc instead of realloc
Date
From: Heinrich Schuchardt <xypron.glpk@gmx.de>

fdtput.c:
Replace the remaining call to realloc by xrealloc.
Some redundant lines in encode_value can be saved.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
fdtput.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/fdtput.c b/fdtput.c
index 5226a4e..2a8d674 100644
--- a/fdtput.c
+++ b/fdtput.c
@@ -96,12 +96,7 @@ static int encode_value(struct display_info *disp, char **arg, int arg_count,
/* enlarge our value buffer by a suitable margin if needed */
if (upto + len > value_size) {
value_size = (upto + len) + 500;
- value = realloc(value, value_size);
- if (!value) {
- fprintf(stderr, "Out of mmory: cannot alloc "
- "%d bytes\n", value_size);
- return -1;
- }
+ value = xrealloc(value, value_size);
}

ptr = value + upto;
--
1.7.10.4


\
 
 \ /
  Last update: 2014-03-02 22:21    [W:0.037 / U:0.400 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site