| # | 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 | } | |
| – | Removed lines |
| + | Added lines |
| < | Changed lines |
| > | Changed lines |