]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
vol-check-malloc-return-20030208
authorDerrick Brashear <shadow@dementia.org>
Sat, 8 Feb 2003 07:38:39 +0000 (07:38 +0000)
committerDerrick Brashear <shadow@dementia.org>
Sat, 8 Feb 2003 07:38:39 +0000 (07:38 +0000)
make sure malloc doesn't fail in vol package either

src/vol/clone.c
src/vol/vnode.c
src/vol/volume.c

index 00115595f61f034da54c47357c727832785bf6a9..fdaac8e871c155236b2f854c9fd3a867b311166c 100644 (file)
@@ -94,6 +94,10 @@ struct clone_head *ah; {
     /* if no last elt (first call) or last item full, get a new one */
     if ((!ah->last) || ah->last->nitems >= CLONE_MAXITEMS) {
        ti = (struct clone_items *) malloc(sizeof(struct clone_items));
+       if (!ti) {
+           Log("ci_AddItem: malloc failed\n");
+           assert(0);
+       }
        ti->nitems = 0;
        ti->next = (struct clone_items *) 0;
        if (ah->last) {
index ee3e663b3db3955296fcc5a6663c32ab3f18b220..0e7eb7924d796bbfc60a2a4408fcf31ceb373376 100644 (file)
@@ -392,6 +392,7 @@ Vnode *VAllocVnode_r(ec,vp,type)
          } else {
              /* growing file - grow in a reasonable increment */
              char *buf = (char *)malloc(16*1024);
+             if (!buf) Abort("VAllocVnode: malloc failed\n");
              memset(buf, 0, 16*1024);
              FDH_WRITE(fdP, buf, 16*1024);
              free(buf);
index 9f825bfddc128a7c51b222a3f95fdb3b1cd6c4a1..709ced5de292eac3dafbd3ff30198d504eaba1b4 100644 (file)
@@ -1719,6 +1719,7 @@ void VAddToVolumeUpdateList_r(Error *ec, Volume *vp)
            UpdateList = (VolumeId *) realloc(UpdateList, sizeof (VolumeId) * updateSize);
        }
     }
+    assert(UpdateList != NULL);
     UpdateList[nUpdatedVolumes++] = V_id(vp);
 }