summaryrefslogtreecommitdiff
path: root/xs.h
diff options
context:
space:
mode:
Diffstat (limited to 'xs.h')
-rw-r--r--xs.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/xs.h b/xs.h
index c44a8a0..079b1f2 100644
--- a/xs.h
+++ b/xs.h
@@ -213,8 +213,18 @@ d_char *xs_expand(d_char *data, int offset, int size)
213 int n; 213 int n;
214 214
215 /* open room */ 215 /* open room */
216 if (sz == 0 || _xs_blk_size(sz) != _xs_blk_size(sz + size)) 216 if (sz == 0 || _xs_blk_size(sz) != _xs_blk_size(sz + size)) {
217 data = realloc(data, _xs_blk_size(sz + size)); 217 d_char *ndata;
218
219 ndata = realloc(data, _xs_blk_size(sz + size));
220
221 if (ndata == NULL) {
222 fprintf(stderr, "**OUT OF MEMORY**");
223 abort();
224 }
225 else
226 data = ndata;
227 }
218 228
219 /* move up the rest of the data */ 229 /* move up the rest of the data */
220 for (n = sz + size - 1; n >= offset + size; n--) 230 for (n = sz + size - 1; n >= offset + size; n--)