Skip to content

Commit d52e359

Browse files
committed
Change calloc/realloc calls to solv_calloc/solv_realloc
Spotted by Jaroslav Rohel, thanks!
1 parent 7c177b5 commit d52e359

4 files changed

Lines changed: 4 additions & 9 deletions

File tree

ext/repo_appdata.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ indent(struct parsedata *pd, int il)
183183
if (xmlp->lcontent + il + 1 > xmlp->acontent)
184184
{
185185
xmlp->acontent = xmlp->lcontent + il + 256;
186-
xmlp->content = realloc(xmlp->content, xmlp->acontent);
186+
xmlp->content = solv_realloc(xmlp->content, xmlp->acontent);
187187
}
188188
memmove(xmlp->content + l + il, xmlp->content + l, xmlp->lcontent - l + 1);
189189
for (i = 0; i < il; i++)

ext/repo_helix.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ endElement(struct solv_xmlparser *xmlp, int state, char *content)
655655
if (xmlp->lcontent + 1 + pd->levrspace > pd->aevrspace)
656656
{
657657
pd->aevrspace = xmlp->lcontent + 1 + pd->levrspace + 256;
658-
pd->evrspace = (char *)realloc(pd->evrspace, pd->aevrspace);
658+
pd->evrspace = (char *)solv_realloc(pd->evrspace, pd->aevrspace);
659659
}
660660
memcpy(pd->evrspace + pd->levrspace, xmlp->content, xmlp->lcontent + 1);
661661
if (state == STATE_EPOCH)

ext/solv_xfopen.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,7 @@ static LZFILE *lzopen(const char *path, const char *mode, int fd, int isxz)
182182
fp = fopen(path, encoding ? "w" : "r");
183183
if (!fp)
184184
return 0;
185-
lzfile = calloc(1, sizeof(*lzfile));
186-
if (!lzfile)
187-
{
188-
fclose(fp);
189-
return 0;
190-
}
185+
lzfile = solv_calloc(1, sizeof(*lzfile));
191186
lzfile->file = fp;
192187
lzfile->encoding = encoding;
193188
lzfile->eof = 0;

src/repo_write.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1446,7 +1446,7 @@ for (i = 1; i < target.nkeys; i++)
14461446
reloff += 3 * target.nkeys;
14471447
}
14481448

1449-
needid = calloc(reloff + pool->nrels, sizeof(*needid));
1449+
needid = solv_calloc(reloff + pool->nrels, sizeof(*needid));
14501450
needid[0].map = reloff; /* remember size in case we need to grow */
14511451

14521452
cbdata.needid = needid;

0 commit comments

Comments
 (0)