Check alloc_data result in krb5int_old_encrypt
[krb5.git] / src / lib / crypto / krb / enc_old.c
index f33cacb5c4c6b129b2a33d13b577c8b8ea578b9a..e7160b16928749d5008d79cb0bb13560678fa137 100644 (file)
@@ -104,6 +104,8 @@ krb5int_old_encrypt(const struct krb5_keytypes *ktp, krb5_key key,
     /* Use the key as the ivec for des-cbc-crc if none was provided. */
     if (key->keyblock.enctype == ENCTYPE_DES_CBC_CRC && ivec == NULL) {
         ret = alloc_data(&crcivec, key->keyblock.length);
+        if (ret != 0)
+            goto cleanup;
         memcpy(crcivec.data, key->keyblock.contents, key->keyblock.length);
         ivec = &crcivec;
     }