ead: clean up
Remove unused variables Correct some (non important) memory leaks Remove fclose(NULL) Correct possible out of bound access spotted with cppcheck Signed-off-by: Etienne CHAMPETIER <etienne.champetier@free.fr> SVN-Revision: 39994
This commit is contained in:
parent
7c029cc262
commit
5a6f00b846
6 changed files with 16 additions and 18 deletions
|
@ -120,8 +120,8 @@ set_recv_type(pcap_t *p, bool rx)
|
||||||
#ifdef PACKET_RECV_TYPE
|
#ifdef PACKET_RECV_TYPE
|
||||||
struct sockaddr_ll sll;
|
struct sockaddr_ll sll;
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
int ifindex, mask;
|
int mask;
|
||||||
int fd, ret;
|
int fd;
|
||||||
|
|
||||||
fd = pcap_get_selectable_fd(p);
|
fd = pcap_get_selectable_fd(p);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
|
@ -132,7 +132,7 @@ set_recv_type(pcap_t *p, bool rx)
|
||||||
else
|
else
|
||||||
mask = 0;
|
mask = 0;
|
||||||
|
|
||||||
ret = setsockopt(fd, SOL_PACKET, PACKET_RECV_TYPE, &mask, sizeof(mask));
|
setsockopt(fd, SOL_PACKET, PACKET_RECV_TYPE, &mask, sizeof(mask));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -841,7 +841,7 @@ static int
|
||||||
check_bridge_port(const char *br, const char *port, void *arg)
|
check_bridge_port(const char *br, const char *port, void *arg)
|
||||||
{
|
{
|
||||||
struct ead_instance *in;
|
struct ead_instance *in;
|
||||||
struct list_head *p, *tmp;
|
struct list_head *p;
|
||||||
|
|
||||||
list_for_each(p, &instances) {
|
list_for_each(p, &instances) {
|
||||||
in = list_entry(p, struct ead_instance, list);
|
in = list_entry(p, struct ead_instance, list);
|
||||||
|
@ -873,7 +873,7 @@ check_all_interfaces(void)
|
||||||
{
|
{
|
||||||
#ifdef linux
|
#ifdef linux
|
||||||
struct ead_instance *in;
|
struct ead_instance *in;
|
||||||
struct list_head *p, *tmp;
|
struct list_head *p;
|
||||||
|
|
||||||
br_foreach_bridge(check_bridge, NULL);
|
br_foreach_bridge(check_bridge, NULL);
|
||||||
|
|
||||||
|
|
|
@ -68,10 +68,6 @@ int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx)
|
||||||
#if defined(BN_MUL_COMBA) || defined(BN_RECURSION)
|
#if defined(BN_MUL_COMBA) || defined(BN_RECURSION)
|
||||||
int i;
|
int i;
|
||||||
#endif
|
#endif
|
||||||
#ifdef BN_RECURSION
|
|
||||||
BIGNUM *t;
|
|
||||||
int j,k;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef BN_COUNT
|
#ifdef BN_COUNT
|
||||||
printf("BN_mul %d * %d\n",a->top,b->top);
|
printf("BN_mul %d * %d\n",a->top,b->top);
|
||||||
|
|
|
@ -50,8 +50,6 @@ main()
|
||||||
int index;
|
int index;
|
||||||
struct t_client * tc;
|
struct t_client * tc;
|
||||||
struct t_preconf *tcp;
|
struct t_preconf *tcp;
|
||||||
struct t_num n;
|
|
||||||
struct t_num g;
|
|
||||||
struct t_num s;
|
struct t_num s;
|
||||||
struct t_num B;
|
struct t_num B;
|
||||||
char username[MAXUSERLEN];
|
char username[MAXUSERLEN];
|
||||||
|
|
|
@ -58,8 +58,6 @@ t_clientopen(u, n, g, s)
|
||||||
int i, validated;
|
int i, validated;
|
||||||
struct t_preconf * tpc;
|
struct t_preconf * tpc;
|
||||||
|
|
||||||
BigInteger nn, gg, n12, r;
|
|
||||||
|
|
||||||
validated = 0;
|
validated = 0;
|
||||||
if(n->len < MIN_MOD_BYTES)
|
if(n->len < MIN_MOD_BYTES)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -161,7 +161,7 @@ t_fromb64(dst, src)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
while(a[j] == 0 && j <= size)
|
while(j <= size && a[j] == 0)
|
||||||
++j;
|
++j;
|
||||||
|
|
||||||
memcpy(dst, a + j, size - j + 1);
|
memcpy(dst, a + j, size - j + 1);
|
||||||
|
|
|
@ -62,7 +62,6 @@ void doit(char *name)
|
||||||
{
|
{
|
||||||
char passphrase[128], passphrase1[128];
|
char passphrase[128], passphrase1[128];
|
||||||
FILE *f;
|
FILE *f;
|
||||||
struct t_conf *tc;
|
|
||||||
struct t_confent *tcent;
|
struct t_confent *tcent;
|
||||||
struct t_pw eps_passwd;
|
struct t_pw eps_passwd;
|
||||||
|
|
||||||
|
@ -152,7 +151,8 @@ t_changepw(pwname, diff)
|
||||||
if((bakfp = fopen(bakfile2, "wb")) == NULL &&
|
if((bakfp = fopen(bakfile2, "wb")) == NULL &&
|
||||||
(unlink(bakfile2) < 0 || (bakfp = fopen(bakfile2, "wb")) == NULL)) {
|
(unlink(bakfile2) < 0 || (bakfp = fopen(bakfile2, "wb")) == NULL)) {
|
||||||
fclose(passfp);
|
fclose(passfp);
|
||||||
fclose(bakfp);
|
free(bakfile);
|
||||||
|
free(bakfile2);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,10 +169,16 @@ t_changepw(pwname, diff)
|
||||||
|
|
||||||
#ifdef USE_RENAME
|
#ifdef USE_RENAME
|
||||||
unlink(bakfile);
|
unlink(bakfile);
|
||||||
if(rename(pwname, bakfile) < 0)
|
if(rename(pwname, bakfile) < 0) {
|
||||||
|
free(bakfile);
|
||||||
|
free(bakfile2);
|
||||||
return -1;
|
return -1;
|
||||||
if(rename(bakfile2, pwname) < 0)
|
}
|
||||||
|
if(rename(bakfile2, pwname) < 0) {
|
||||||
|
free(bakfile);
|
||||||
|
free(bakfile2);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
unlink(bakfile);
|
unlink(bakfile);
|
||||||
link(pwname, bakfile);
|
link(pwname, bakfile);
|
||||||
|
|
Loading…
Reference in a new issue