diff options
Diffstat (limited to 'scripts/kconfig/util.c')
-rw-r--r-- | scripts/kconfig/util.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c index 0e76042473cc..138894ef49ea 100644 --- a/scripts/kconfig/util.c +++ b/scripts/kconfig/util.c | |||
@@ -104,7 +104,7 @@ void str_append(struct gstr *gs, const char *s) | |||
104 | if (s) { | 104 | if (s) { |
105 | l = strlen(gs->s) + strlen(s) + 1; | 105 | l = strlen(gs->s) + strlen(s) + 1; |
106 | if (l > gs->len) { | 106 | if (l > gs->len) { |
107 | gs->s = realloc(gs->s, l); | 107 | gs->s = xrealloc(gs->s, l); |
108 | gs->len = l; | 108 | gs->len = l; |
109 | } | 109 | } |
110 | strcat(gs->s, s); | 110 | strcat(gs->s, s); |
@@ -145,3 +145,12 @@ void *xcalloc(size_t nmemb, size_t size) | |||
145 | fprintf(stderr, "Out of memory.\n"); | 145 | fprintf(stderr, "Out of memory.\n"); |
146 | exit(1); | 146 | exit(1); |
147 | } | 147 | } |
148 | |||
149 | void *xrealloc(void *p, size_t size) | ||
150 | { | ||
151 | p = realloc(p, size); | ||
152 | if (p) | ||
153 | return p; | ||
154 | fprintf(stderr, "Out of memory.\n"); | ||
155 | exit(1); | ||
156 | } | ||