Skip to content

Commit

Permalink
Merge pull request #66 from bowb/master
Browse files Browse the repository at this point in the history
Memory leak fixes. Many thanks to bowb!
  • Loading branch information
wolneykien authored Mar 6, 2023
2 parents 3f9f0fd + 87ce2b9 commit b12a3eb
Show file tree
Hide file tree
Showing 15 changed files with 302 additions and 194 deletions.
2 changes: 1 addition & 1 deletion src/common/algorithm.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const ALGDIGEST *Alg_get_digest_by_name(ALGORITHM_TYPE hash)

ALGORITHM_TYPE Alg_get_alg_from_string(const char *hashString)
{
const EVP_MD *digest;
const EVP_MD *digest = NULL;

digest = EVP_get_digestbyname(hashString);
if (!digest) {
Expand Down
10 changes: 5 additions & 5 deletions src/common/base64.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static const unsigned char bin_table[128] = {
};

static int from_base64(const char *in, unsigned int *out, int *skip) {
unsigned int res = 0, c, s = 18;
unsigned int res = 0, c = 0, s = 18;
const char *in0 = in;

for (c = 0; c < 4; c++, in++) {
Expand All @@ -79,8 +79,8 @@ static int from_base64(const char *in, unsigned int *out, int *skip) {
}

int base64_encode(const unsigned char *in, size_t len, unsigned char *out, size_t *outlen) {
size_t i, len2, leven;
unsigned char *p;
size_t i = 0, len2 = 0, leven = 0;
unsigned char *p = NULL;

if (!in) return -1;
if (!out) return -1;
Expand Down Expand Up @@ -120,8 +120,8 @@ int base64_encode(const unsigned char *in, size_t len, unsigned char *out, size
}

int base64_decode(const char *in, unsigned char *out, size_t outlen) {
int len = 0, r, skip;
unsigned int i;
int len = 0, r = 0, skip = 0;
unsigned int i = 0;

while ((r = from_base64(in, &i, &skip)) > 0) {
int finished = 0, s = 16;
Expand Down
Loading

0 comments on commit b12a3eb

Please sign in to comment.