replaced deallocateDoublePointer with deallocateDecryptedOutput

This commit is contained in:
Václav Šmejkal 2023-01-25 14:13:52 +01:00
parent e7282dec5a
commit d16f48b760
Signed by: ENGO150
GPG Key ID: F6D6DF86242C5A59
2 changed files with 6 additions and 12 deletions

View File

@ -22,7 +22,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <why2/logger/flags.h> #include <why2/logger/flags.h>
void deallocateLogger(logFile logger); //USE THIS IF YOU WANT TO DEALLOCATE FILE POINTER RETURNED BY logger'S initLogger void deallocateLogger(logFile logger); //USE THIS IF YOU WANT TO DEALLOCATE FILE POINTER RETURNED BY logger'S initLogger
void deallocateDoublePointer(char **string); //DEALLOCATION OF POINTER-TO-POINTER, WHY TF ARE YOU READING THIS void deallocateDecryptedOutput(decryptedOutput output); //DEALLOCATION OF POINTER-TO-POINTER, WHY TF ARE YOU READING THIS
decryptedOutput decryptLogger(logFile logger); //PASS logger AND FLAGS, AND PROGRAM WILL DECRYPT YOUR LOG... WHAT DID YOU EXPECT? decryptedOutput decryptLogger(logFile logger); //PASS logger AND FLAGS, AND PROGRAM WILL DECRYPT YOUR LOG... WHAT DID YOU EXPECT?
#endif #endif

View File

@ -35,21 +35,15 @@ void deallocateLogger(logFile logger)
free(logger.fileName); free(logger.fileName);
} }
void deallocateDoublePointer(char **string) void deallocateDecryptedOutput(decryptedOutput output)
{ {
int buffer = 0; for (int i = 0; i < output.length; i++)
for (; 1; buffer++) //GET string SIZE (FIRST DIM)
{ {
if (!string[buffer]) break; free(output.decryptedText[i]);
} }
for (int i = 0; i < buffer; i++) //LOAD ELEMENTS output.length = 0;
{ free(output.decryptedText);
free(string[i]); //DEALLOCATE ELEMENTS
}
free(string); //no
} }
decryptedOutput decryptLogger(logFile logger) //TODO: Fix valgrind issues decryptedOutput decryptLogger(logFile logger) //TODO: Fix valgrind issues