]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Change calloc/realloc calls to solv_calloc/solv_realloc
authorMichael Schroeder <mls@suse.de>
Wed, 31 Mar 2021 11:46:16 +0000 (13:46 +0200)
committerMichael Schroeder <mls@suse.de>
Wed, 31 Mar 2021 11:48:42 +0000 (13:48 +0200)
Spotted by Jaroslav Rohel, thanks!

ext/repo_appdata.c
ext/repo_helix.c
ext/solv_xfopen.c
src/repo_write.c

index b798af4c198cd8dc08c750132a3237a5761d624a..390b286d11692d6b780a4ff2c45327ead60a6e4e 100644 (file)
@@ -183,7 +183,7 @@ indent(struct parsedata *pd, int il)
       if (xmlp->lcontent + il + 1 > xmlp->acontent)
        {
          xmlp->acontent = xmlp->lcontent + il + 256;
-         xmlp->content = realloc(xmlp->content, xmlp->acontent);
+         xmlp->content = solv_realloc(xmlp->content, xmlp->acontent);
        }
       memmove(xmlp->content + l + il, xmlp->content + l, xmlp->lcontent - l + 1);
       for (i = 0; i < il; i++)
index 37359bbff9f989047178ac76d4f8ee6a99a1ce2f..f4bea55e808937aabec2daa6b5a844d30386b1f4 100644 (file)
@@ -655,7 +655,7 @@ endElement(struct solv_xmlparser *xmlp, int state, char *content)
       if (xmlp->lcontent + 1 + pd->levrspace > pd->aevrspace)
        {
          pd->aevrspace = xmlp->lcontent + 1 + pd->levrspace + 256;
-         pd->evrspace = (char *)realloc(pd->evrspace, pd->aevrspace);
+         pd->evrspace = (char *)solv_realloc(pd->evrspace, pd->aevrspace);
        }
       memcpy(pd->evrspace + pd->levrspace, xmlp->content, xmlp->lcontent + 1);
       if (state == STATE_EPOCH)
index 7e974a91a97abfdecd73dc65ff7043b3f814f688..b3136cbbe862a9b742d606f3a7a1f229d84e8ffb 100644 (file)
@@ -182,12 +182,7 @@ static LZFILE *lzopen(const char *path, const char *mode, int fd, int isxz)
     fp = fopen(path, encoding ? "w" : "r");
   if (!fp)
     return 0;
-  lzfile = calloc(1, sizeof(*lzfile));
-  if (!lzfile)
-    {
-      fclose(fp);
-      return 0;
-    }
+  lzfile = solv_calloc(1, sizeof(*lzfile));
   lzfile->file = fp;
   lzfile->encoding = encoding;
   lzfile->eof = 0;
index 0f9fc4fd251eb26473313994e1bd32b5887c7c63..af4e7599576059db1867ac0d7956c496903db20a 100644 (file)
@@ -1446,7 +1446,7 @@ for (i = 1; i < target.nkeys; i++)
       reloff += 3 * target.nkeys;
     }
 
-  needid = calloc(reloff + pool->nrels, sizeof(*needid));
+  needid = solv_calloc(reloff + pool->nrels, sizeof(*needid));
   needid[0].map = reloff;      /* remember size in case we need to grow */
 
   cbdata.needid = needid;