Don't seg when out of memory (bug #2120)

git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@129 2fbb986a-6c06-0410-b554-c9c1f0a7f128
This commit is contained in:
Mark Spencer 2004-07-23 16:04:01 +00:00
parent 6dd859f5de
commit 748702c5c5

2
q921.c
View File

@ -383,8 +383,8 @@ int q921_transmit_iframe(struct pri *pri, void *buf, int len, int cr)
q921_frame *f, *prev=NULL; q921_frame *f, *prev=NULL;
for (f=pri->txqueue; f; f = f->next) prev = f; for (f=pri->txqueue; f; f = f->next) prev = f;
f = malloc(sizeof(q921_frame) + len + 2); f = malloc(sizeof(q921_frame) + len + 2);
memset(f,0,sizeof(q921_frame) + len + 2);
if (f) { if (f) {
memset(f,0,sizeof(q921_frame) + len + 2);
Q921_INIT(pri, f->h); Q921_INIT(pri, f->h);
switch(pri->localtype) { switch(pri->localtype) {
case PRI_NETWORK: case PRI_NETWORK: