summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2015-07-20 15:43:24 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2015-07-20 15:43:24 +0000
commit4fa76482fa90560532374f5988e4fa9d1b5b29ef (patch)
tree830c77c2a474d351bd78725adb68aee363178917 /lib
parent2aeb0f0a8ca3469ac64cec74b7c8d546f0021f56 (diff)
Use V_ASN1_UNDEF instead of -1.
Make sure ASN1_primitive_new() will return NULL in *pval in all error situations. ok bcook@ doug@
Diffstat (limited to 'lib')
-rw-r--r--lib/libcrypto/asn1/tasn_new.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/libcrypto/asn1/tasn_new.c b/lib/libcrypto/asn1/tasn_new.c
index 132df07637f..986e5811b6c 100644
--- a/lib/libcrypto/asn1/tasn_new.c
+++ b/lib/libcrypto/asn1/tasn_new.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tasn_new.c,v 1.14 2015/02/14 15:23:57 miod Exp $ */
+/* $OpenBSD: tasn_new.c,v 1.15 2015/07/20 15:43:23 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2000.
*/
@@ -313,7 +313,7 @@ ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
}
if (!it || (it->itype == ASN1_ITYPE_MSTRING))
- utype = -1;
+ utype = V_ASN1_UNDEF;
else
utype = it->utype;
switch (utype) {
@@ -331,10 +331,10 @@ ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it)
case V_ASN1_ANY:
typ = malloc(sizeof(ASN1_TYPE));
- if (!typ)
- return 0;
- typ->value.ptr = NULL;
- typ->type = -1;
+ if (typ != NULL) {
+ typ->value.ptr = NULL;
+ typ->type = V_ASN1_UNDEF;
+ }
*pval = (ASN1_VALUE *)typ;
break;
@@ -364,7 +364,7 @@ asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it)
return;
}
if (!it || (it->itype == ASN1_ITYPE_MSTRING))
- utype = -1;
+ utype = V_ASN1_UNDEF;
else
utype = it->utype;
if (utype == V_ASN1_BOOLEAN)