Show More
@@ -84,10 +84,7 b' static void enlargecontext(context_t *ct' | |||
|
84 | 84 | |
|
85 | 85 | newsize = defaultdatasize |
|
86 | 86 | * ((newsize + defaultdatasize - 1) / defaultdatasize); |
|
87 |
c |
|
|
88 | if (!p) | |
|
89 | abortmsg("failed to allocate buffer"); | |
|
90 | ctx->data = p; | |
|
87 | ctx->data = reallocx(ctx->data, newsize); | |
|
91 | 88 | ctx->maxdatasize = newsize; |
|
92 | 89 | debugmsg("enlarge context buffer to %zu", ctx->maxdatasize); |
|
93 | 90 | } |
@@ -195,9 +192,7 b' static const char **unpackcmdargsnul(con' | |||
|
195 | 192 | for (;;) { |
|
196 | 193 | if (nargs + 1 >= maxnargs) { /* including last NULL */ |
|
197 | 194 | maxnargs += 256; |
|
198 | args = realloc(args, maxnargs * sizeof(args[0])); | |
|
199 | if (!args) | |
|
200 | abortmsg("failed to allocate args buffer"); | |
|
195 | args = reallocx(args, maxnargs * sizeof(args[0])); | |
|
201 | 196 | } |
|
202 | 197 | args[nargs] = s; |
|
203 | 198 | nargs++; |
@@ -432,9 +427,7 b' hgclient_t *hgc_open(const char *socknam' | |||
|
432 | 427 | addr.sun_path, errno); |
|
433 | 428 | } |
|
434 | 429 | |
|
435 | hgclient_t *hgc = malloc(sizeof(hgclient_t)); | |
|
436 | if (!hgc) | |
|
437 | abortmsg("failed to allocate hgclient object"); | |
|
430 | hgclient_t *hgc = mallocx(sizeof(hgclient_t)); | |
|
438 | 431 | memset(hgc, 0, sizeof(*hgc)); |
|
439 | 432 | hgc->sockfd = fd; |
|
440 | 433 | initcontext(&hgc->ctx); |
General Comments 0
You need to be logged in to leave comments.
Login now