forked from Mirrors/freeswitch
[iksemel, libdingaling] scan-build: fix multiple dead assignments and dereference of null pointer
This commit is contained in:
parent
14913244a3
commit
5e5fd214b5
|
@ -32,7 +32,7 @@ static ikschunk *
|
||||||
find_space (ikstack *s, ikschunk *c, size_t size)
|
find_space (ikstack *s, ikschunk *c, size_t size)
|
||||||
{
|
{
|
||||||
/* FIXME: dont use *2 after over allocated chunks */
|
/* FIXME: dont use *2 after over allocated chunks */
|
||||||
while (1) {
|
while (c) {
|
||||||
if (c->size - c->used >= size) return c;
|
if (c->size - c->used >= size) return c;
|
||||||
if (!c->next) {
|
if (!c->next) {
|
||||||
if ((c->size * 2) > size) size = c->size * 2;
|
if ((c->size * 2) > size) size = c->size * 2;
|
||||||
|
|
|
@ -213,22 +213,16 @@ sax_core (iksparser *prs, char *buf, int len)
|
||||||
goto cont;
|
goto cont;
|
||||||
} else {
|
} else {
|
||||||
if (c & 0x80) {
|
if (c & 0x80) {
|
||||||
unsigned char mask;
|
|
||||||
if ((c & 0x60) == 0x40) {
|
if ((c & 0x60) == 0x40) {
|
||||||
prs->uni_max = 2;
|
prs->uni_max = 2;
|
||||||
mask = 0x1F;
|
|
||||||
} else if ((c & 0x70) == 0x60) {
|
} else if ((c & 0x70) == 0x60) {
|
||||||
prs->uni_max = 3;
|
prs->uni_max = 3;
|
||||||
mask = 0x0F;
|
|
||||||
} else if ((c & 0x78) == 0x70) {
|
} else if ((c & 0x78) == 0x70) {
|
||||||
prs->uni_max = 4;
|
prs->uni_max = 4;
|
||||||
mask = 0x07;
|
|
||||||
} else if ((c & 0x7C) == 0x78) {
|
} else if ((c & 0x7C) == 0x78) {
|
||||||
prs->uni_max = 5;
|
prs->uni_max = 5;
|
||||||
mask = 0x03;
|
|
||||||
} else if ((c & 0x7E) == 0x7C) {
|
} else if ((c & 0x7E) == 0x7C) {
|
||||||
prs->uni_max = 6;
|
prs->uni_max = 6;
|
||||||
mask = 0x01;
|
|
||||||
} else {
|
} else {
|
||||||
return IKS_BADXML;
|
return IKS_BADXML;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ test_stack (int cs)
|
||||||
memset (mem, 'x', i);
|
memset (mem, 'x', i);
|
||||||
old = iks_stack_strcat (s, old, 0, buf + i, 1);
|
old = iks_stack_strcat (s, old, 0, buf + i, 1);
|
||||||
}
|
}
|
||||||
if (strcmp (old, buf) != 0) {
|
if (old && strcmp (old, buf) != 0) {
|
||||||
printf ("ikstack strcat bug:\nExpected: %s\n Result: %s\n", buf, old);
|
printf ("ikstack strcat bug:\nExpected: %s\n Result: %s\n", buf, old);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,7 @@ tagHook (void *udata, char *name, char **atts, int type)
|
||||||
nr = tester.cur->nr_atts;
|
nr = tester.cur->nr_atts;
|
||||||
while (nr) {
|
while (nr) {
|
||||||
flag = 0;
|
flag = 0;
|
||||||
for (i = 0;atts[i]; i+= 2) {
|
for (i = 0;atts&&atts[i]; i+= 2) {
|
||||||
if (iks_strcmp (atts[i], tester.cur->atts[nr-1]) == 0 && iks_strcmp (atts[i+1], tester.cur->vals[nr-1]) == 0) {
|
if (iks_strcmp (atts[i], tester.cur->atts[nr-1]) == 0 && iks_strcmp (atts[i+1], tester.cur->vals[nr-1]) == 0) {
|
||||||
flag = 1;
|
flag = 1;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -117,7 +117,7 @@ hash_print (hash *h, char *title_fmt, char *line_fmt)
|
||||||
struct item **tags, *t;
|
struct item **tags, *t;
|
||||||
unsigned int i = 0, pos = 0;
|
unsigned int i = 0, pos = 0;
|
||||||
|
|
||||||
tags = calloc (sizeof (struct tag *), h->count);
|
tags = calloc (sizeof (struct item *), h->count);
|
||||||
|
|
||||||
for (; i < h->size; i ++) {
|
for (; i < h->size; i ++) {
|
||||||
for (t = h->table[i]; t; t = t->next) {
|
for (t = h->table[i]; t; t = t->next) {
|
||||||
|
|
|
@ -207,7 +207,6 @@ serialize_test (char *buf, int len)
|
||||||
unsigned long time;
|
unsigned long time;
|
||||||
iks *x;
|
iks *x;
|
||||||
iksparser *prs;
|
iksparser *prs;
|
||||||
char *xml;
|
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
prs = iks_dom_new (&x);
|
prs = iks_dom_new (&x);
|
||||||
|
@ -228,7 +227,7 @@ serialize_test (char *buf, int len)
|
||||||
|
|
||||||
t_reset ();
|
t_reset ();
|
||||||
|
|
||||||
xml = iks_string (iks_stack (x), x);
|
iks_string (iks_stack (x), x);
|
||||||
|
|
||||||
time = t_elapsed ();
|
time = t_elapsed ();
|
||||||
|
|
||||||
|
|
|
@ -930,7 +930,7 @@ static int on_disco_default(void *user_data, ikspak *pak)
|
||||||
char *node = NULL;
|
char *node = NULL;
|
||||||
char *ns = NULL;
|
char *ns = NULL;
|
||||||
ldl_handle_t *handle = user_data;
|
ldl_handle_t *handle = user_data;
|
||||||
iks *iq, *query, *tag;
|
iks *iq = NULL, *query, *tag;
|
||||||
uint8_t send = 0;
|
uint8_t send = 0;
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue