remove unnecessary calls to EC_POINT_copy()
[openssl.git] / crypto / objects / obj_dat.c
index 8094c7df95f4da09982e89bbf72b6c5dc12cf9be..3ff64bb8d13ffda597929f1cea53c2fcea947220 100644 (file)
@@ -236,7 +236,7 @@ int OBJ_add_object(const ASN1_OBJECT *obj)
        if (added == NULL)
                if (!init_added()) return(0);
        if ((o=OBJ_dup(obj)) == NULL) goto err;
-       ao[ADDED_NID]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ));
+       if (!(ao[ADDED_NID]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ)))) goto err;
        if ((o->length != 0) && (obj->data != NULL))
                ao[ADDED_DATA]=(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ));
        if (o->sn != NULL)
@@ -445,8 +445,7 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
                return(0);
        }
 
-       nid=OBJ_obj2nid(a);
-       if ((nid == NID_undef) || no_name) {
+       if (no_name || (nid=OBJ_obj2nid(a)) == NID_undef) {
                len=a->length;
                p=a->data;
 
@@ -654,6 +653,8 @@ int OBJ_create(const char *oid, const char *sn, const char *ln)
                return(0);
                }
        i=a2d_ASN1_OBJECT(buf,i,oid,-1);
+       if (i == 0)
+               goto err;
        op=(ASN1_OBJECT *)ASN1_OBJECT_create(OBJ_new_nid(1),buf,i,sn,ln);
        if (op == NULL) 
                goto err;