Found with -Wunreachable-code clang compiler option.
The errors were:
./print-esp.c:263:3: warning: code will never be executed
[-Wunreachable-code]
free(input_buffer);
^~~~
./print-esp.c:246:3: warning: code will never be executed
[-Wunreachable-code]
EVP_CIPHER_CTX_free(ctx);
^~~~~~~~~~~~~~~~~~~
./print-esp.c:843:5: warning: code will never be executed
[-Wunreachable-code]
free(input_buffer);
^~~~
./print-esp.c:826:5: warning: code will never be executed
[-Wunreachable-code]
EVP_CIPHER_CTX_free(ctx);
^~~~~~~~~~~~~~~~~~~
*/
input_buffer = (u_char *)malloc(buffer_size);
if (input_buffer == NULL) {
*/
input_buffer = (u_char *)malloc(buffer_size);
if (input_buffer == NULL) {
+ EVP_CIPHER_CTX_free(ctx);
(*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
"can't allocate memory for encrypted data buffer");
(*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
"can't allocate memory for encrypted data buffer");
- EVP_CIPHER_CTX_free(ctx);
- return 0;
}
/*
* Copy the input data to the encrypted data buffer, and pad it
}
/*
* Copy the input data to the encrypted data buffer, and pad it
*/
output_buffer = (u_char *)malloc(buffer_size);
if (output_buffer == NULL) {
*/
output_buffer = (u_char *)malloc(buffer_size);
if (output_buffer == NULL) {
- (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
- "can't allocate memory for decryption buffer");
free(input_buffer);
EVP_CIPHER_CTX_free(ctx);
free(input_buffer);
EVP_CIPHER_CTX_free(ctx);
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
+ "can't allocate memory for decryption buffer");
}
EVP_Cipher(ctx, output_buffer, input_buffer, len);
EVP_CIPHER_CTX_free(ctx);
}
EVP_Cipher(ctx, output_buffer, input_buffer, len);
EVP_CIPHER_CTX_free(ctx);
*/
input_buffer = (u_char *)malloc(buffer_size);
if (input_buffer == NULL) {
*/
input_buffer = (u_char *)malloc(buffer_size);
if (input_buffer == NULL) {
+ EVP_CIPHER_CTX_free(ctx);
(*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
"esp_print: can't allocate memory for encrypted data buffer");
(*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
"esp_print: can't allocate memory for encrypted data buffer");
- EVP_CIPHER_CTX_free(ctx);
- return 0;
}
/*
* Copy the input data to the encrypted data buffer,
}
/*
* Copy the input data to the encrypted data buffer,
*/
output_buffer = (u_char *)malloc(buffer_size);
if (output_buffer == NULL) {
*/
output_buffer = (u_char *)malloc(buffer_size);
if (output_buffer == NULL) {
- (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
- "esp_print: can't allocate memory for decryption buffer");
free(input_buffer);
EVP_CIPHER_CTX_free(ctx);
free(input_buffer);
EVP_CIPHER_CTX_free(ctx);
+ (*ndo->ndo_error)(ndo, S_ERR_ND_MEM_ALLOC,
+ "esp_print: can't allocate memory for decryption buffer");
}
EVP_Cipher(ctx, output_buffer, input_buffer, len);
}
EVP_Cipher(ctx, output_buffer, input_buffer, len);