ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/interp2d.c
(Generate patch)

Comparing ray/src/common/interp2d.c (file contents):
Revision 2.15 by greg, Sat Feb 13 16:49:18 2021 UTC vs.
Revision 2.16 by greg, Thu Mar 11 01:58:59 2021 UTC

# Line 80 | Line 80 | interp2_alloc(int nsamps)
80   INTERP2 *
81   interp2_realloc(INTERP2 *ip, int nsamps)
82   {
83 +        INTERP2 *old_ip = ip;
84 +
85          if (ip == NULL)
86                  return(interp2_alloc(nsamps));
87          if (nsamps <= 1) {
# Line 93 | Line 95 | interp2_realloc(INTERP2 *ip, int nsamps)
95                  ip->da = NULL;
96          }
97          ip = (INTERP2 *)realloc(ip, sizeof(INTERP2)+sizeof(float)*2*(nsamps-1));
98 <        if (ip == NULL)
99 <                return(NULL);
98 >        if (ip == NULL) {
99 >                if (nsamps <= ip->ns)
100 >                        ip = old_ip;
101 >                else
102 >                        return(NULL);
103 >        }
104          ip->ns = nsamps;
105          return(ip);
106   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines