Commit 99e0cb04 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Fix memory leaks in error-handling paths in configuration parser.

parent ac3261f6
......@@ -1224,23 +1224,28 @@ parse_config_line(int c, gnc_t gnc, void *closure,
struct key *key = NULL;
c = parse_key(c, gnc, closure, &key);
if(c < -1 || key == NULL || key->id == NULL) {
if(key != NULL)
free(key->value);
free(key);
goto fail;
}
switch(key->type) {
case AUTH_TYPE_SHA256:
if(key->len != 32) {
free(key->value);
free(key);
goto fail;
}
break;
case AUTH_TYPE_BLAKE2S:
if(key->len != 16) {
free(key->value);
free(key);
goto fail;
}
break;
default:
free(key->value);
free(key);
goto fail;
}
......
......@@ -24,6 +24,7 @@ THE SOFTWARE.
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <sys/time.h>
#include <netinet/in.h>
#include "rfc6234/sha.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment