~mdw
/
sgt
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove some redundant null-pointer checks from code that must have
[sgt/putty]
/
sshdss.c
diff --git
a/sshdss.c
b/sshdss.c
index
2b19a92
..
e634b98
100644
(file)
--- a/
sshdss.c
+++ b/
sshdss.c
@@
-89,8
+89,6
@@
static void *dss_newkey(char *data, int len)
struct dss_key *dss;
dss = snew(struct dss_key);
struct dss_key *dss;
dss = snew(struct dss_key);
- if (!dss)
- return NULL;
getstring(&data, &len, &p, &slen);
#ifdef DEBUG_DSS
getstring(&data, &len, &p, &slen);
#ifdef DEBUG_DSS
@@
-111,6
+109,7
@@
static void *dss_newkey(char *data, int len)
dss->q = getmp(&data, &len);
dss->g = getmp(&data, &len);
dss->y = getmp(&data, &len);
dss->q = getmp(&data, &len);
dss->g = getmp(&data, &len);
dss->y = getmp(&data, &len);
+ dss->x = NULL;
return dss;
}
return dss;
}
@@
-118,10
+117,16
@@
static void *dss_newkey(char *data, int len)
static void dss_freekey(void *key)
{
struct dss_key *dss = (struct dss_key *) key;
static void dss_freekey(void *key)
{
struct dss_key *dss = (struct dss_key *) key;
- freebn(dss->p);
- freebn(dss->q);
- freebn(dss->g);
- freebn(dss->y);
+ if (dss->p)
+ freebn(dss->p);
+ if (dss->q)
+ freebn(dss->q);
+ if (dss->g)
+ freebn(dss->g);
+ if (dss->y)
+ freebn(dss->y);
+ if (dss->x)
+ freebn(dss->x);
sfree(dss);
}
sfree(dss);
}
@@
-423,8
+428,6
@@
static void *dss_openssh_createkey(unsigned char **blob, int *len)
struct dss_key *dss;
dss = snew(struct dss_key);
struct dss_key *dss;
dss = snew(struct dss_key);
- if (!dss)
- return NULL;
dss->p = getmp(b, len);
dss->q = getmp(b, len);
dss->p = getmp(b, len);
dss->q = getmp(b, len);
@@
-433,11
+436,11
@@
static void *dss_openssh_createkey(unsigned char **blob, int *len)
dss->x = getmp(b, len);
if (!dss->p || !dss->q || !dss->g || !dss->y || !dss->x) {
dss->x = getmp(b, len);
if (!dss->p || !dss->q || !dss->g || !dss->y || !dss->x) {
-
sfree
(dss->p);
-
sfree
(dss->q);
-
sfree
(dss->g);
-
sfree
(dss->y);
-
sfree
(dss->x);
+
freebn
(dss->p);
+
freebn
(dss->q);
+
freebn
(dss->g);
+
freebn
(dss->y);
+
freebn
(dss->x);
sfree(dss);
return NULL;
}
sfree(dss);
return NULL;
}