diff options
author | Dr. Stephen Henson <steve@openssl.org> | 1999-11-08 13:58:08 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 1999-11-08 13:58:08 +0000 |
commit | a0ad17bb6cccef6eb7ff0b25403ec2bbc0bd122e (patch) | |
tree | 463e559c53a5e7f8dafaa4c3f1416ea8ce23f104 /crypto/x509 | |
parent | ce1b4fe14648007bf054cf54846c0620e4605251 (diff) | |
download | openssl-a0ad17bb6cccef6eb7ff0b25403ec2bbc0bd122e.tar.gz |
Fix to the -revoke option in ca. It was leaking memory, crashing and just
plain not working :-(
Also fix some memory leaks in the new X509_NAME code.
Fix so new app_rand code doesn't crash 'x509' and move #include so it compiles
under Win32.
Diffstat (limited to 'crypto/x509')
-rw-r--r-- | crypto/x509/x509name.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/crypto/x509/x509name.c b/crypto/x509/x509name.c index bd7b985629..b4ceb65851 100644 --- a/crypto/x509/x509name.c +++ b/crypto/x509/x509name.c @@ -175,27 +175,36 @@ int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type, unsigned char *bytes, int len, int loc, int set) { X509_NAME_ENTRY *ne; + int ret; ne = X509_NAME_ENTRY_create_by_OBJ(NULL, obj, type, bytes, len); if(!ne) return 0; - return X509_NAME_add_entry(name, ne, loc, set); + ret = X509_NAME_add_entry(name, ne, loc, set); + X509_NAME_ENTRY_free(ne); + return ret; } int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type, unsigned char *bytes, int len, int loc, int set) { X509_NAME_ENTRY *ne; + int ret; ne = X509_NAME_ENTRY_create_by_NID(NULL, nid, type, bytes, len); if(!ne) return 0; - return X509_NAME_add_entry(name, ne, loc, set); + ret = X509_NAME_add_entry(name, ne, loc, set); + X509_NAME_ENTRY_free(ne); + return ret; } int X509_NAME_add_entry_by_txt(X509_NAME *name, char *field, int type, unsigned char *bytes, int len, int loc, int set) { X509_NAME_ENTRY *ne; + int ret; ne = X509_NAME_ENTRY_create_by_txt(NULL, field, type, bytes, len); if(!ne) return 0; - return X509_NAME_add_entry(name, ne, loc, set); + ret = X509_NAME_add_entry(name, ne, loc, set); + X509_NAME_ENTRY_free(ne); + return ret; } /* if set is -1, append to previous set, 0 'a new one', and 1, @@ -267,6 +276,7 @@ X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, char *field, int type, unsigned char *bytes, int len) { ASN1_OBJECT *obj; + X509_NAME_ENTRY *nentry; obj=OBJ_txt2obj(field, 0); if (obj == NULL) @@ -275,13 +285,16 @@ X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne, X509_R_INVALID_FIELD_NAME); return(NULL); } - return(X509_NAME_ENTRY_create_by_OBJ(ne,obj,type,bytes,len)); + nentry = X509_NAME_ENTRY_create_by_OBJ(ne,obj,type,bytes,len); + ASN1_OBJECT_free(obj); + return nentry; } X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, int type, unsigned char *bytes, int len) { ASN1_OBJECT *obj; + X509_NAME_ENTRY *nentry; obj=OBJ_nid2obj(nid); if (obj == NULL) @@ -289,7 +302,9 @@ X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid, X509err(X509_F_X509_NAME_ENTRY_CREATE_BY_NID,X509_R_UNKNOWN_NID); return(NULL); } - return(X509_NAME_ENTRY_create_by_OBJ(ne,obj,type,bytes,len)); + nentry = X509_NAME_ENTRY_create_by_OBJ(ne,obj,type,bytes,len); + ASN1_OBJECT_free(obj); + return nentry; } X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne, |