Commit 0a618df0 authored by Matt Caswell's avatar Matt Caswell
Browse files

Fix a mem leak on an error path in OBJ_NAME_add()



If lh_OBJ_NAME_insert() fails then the allocated |onp| value is leaked.

RT#2238

Reviewed-by: default avatarRichard Levitte <levitte@openssl.org>
parent 308ff286
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -191,7 +191,7 @@ int OBJ_NAME_add(const char *name, int type, const char *data)
    onp = OPENSSL_malloc(sizeof(*onp));
    if (onp == NULL) {
        /* ERROR */
        return (0);
        return 0;
    }

    onp->name = name;
@@ -216,10 +216,11 @@ int OBJ_NAME_add(const char *name, int type, const char *data)
    } else {
        if (lh_OBJ_NAME_error(names_lh)) {
            /* ERROR */
            return (0);
            OPENSSL_free(onp);
            return 0;
        }
    }
    return (1);
    return 1;
}

int OBJ_NAME_remove(const char *name, int type)