Add goto fail in asn1_oid_decode() to clean-up exception handling code.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
optr = *oid;
- if (!asn1_subid_decode(&iptr, end, &subid)) {
- kfree(*oid);
- *oid = NULL;
- return false;
- }
+ if (!asn1_subid_decode(&iptr, end, &subid))
+ goto fail;
if (subid < 40) {
optr[0] = 0;
optr += 2;
while (iptr < end) {
- if (++(*oidlen) > vlen) {
- kfree(*oid);
- *oid = NULL;
- return false;
- }
+ if (++(*oidlen) > vlen)
+ goto fail;
- if (!asn1_subid_decode(&iptr, end, optr++)) {
- kfree(*oid);
- *oid = NULL;
- return false;
- }
+ if (!asn1_subid_decode(&iptr, end, optr++))
+ goto fail;
}
return true;
+
+fail:
+ kfree(*oid);
+ *oid = NULL;
+ return false;
}
static bool