int res;
int x;
short *buf;
- short *obuf;
- if (!(buf = ast_calloc(1, 2 * len + cid->oldlen))) {
- return -1;
- }
+ buf = alloca(2 * len + cid->oldlen);
- obuf = buf;
memcpy(buf, cid->oldstuff, cid->oldlen);
mylen += cid->oldlen/2;
buf[x+cid->oldlen/2] = AST_XLAW(ubuf[x]);
while (mylen >= 160) {
- b = b2 = 0 ;
+ b = b2 = 0;
olen = mylen;
res = fsk_serie(&cid->fskd, buf, &mylen, &b);
cid->oldlen = mylen * 2;
} else
cid->oldlen = 0;
- free(obuf);
+
return 0;
}
int res;
int x;
short *buf;
- short *obuf;
- if (!(buf = ast_calloc(1, 2 * len + cid->oldlen))) {
- return -1;
- }
+ buf = alloca(2 * len + cid->oldlen);
- obuf = buf;
memcpy(buf, cid->oldstuff, cid->oldlen);
mylen += cid->oldlen/2;
for (x=0;x<len;x++)
buf[x+cid->oldlen/2] = AST_XLAW(ubuf[x]);
- while(mylen >= 160) {
+ while (mylen >= 160) {
olen = mylen;
res = fsk_serie(&cid->fskd, buf, &mylen, &b);
if (mylen < 0) {
ast_log(LOG_ERROR, "fsk_serie made mylen < 0 (%d)\n", mylen);
- free(obuf);
return -1;
}
buf += (olen - mylen);
case 4: /* Retrieve message */
if (cid->pos >= 128) {
ast_log(LOG_WARNING, "Caller ID too long???\n");
- free(obuf);
return -1;
}
cid->rawdata[cid->pos++] = b;
strcpy(cid->name, "");
cid->flags |= CID_UNKNOWN_NAME;
}
- free(obuf);
return 1;
break;
default:
cid->oldlen = mylen * 2;
} else
cid->oldlen = 0;
- free(obuf);
return 0;
}