Bug fix for the following error caught by the test suite (in the [Rijndael SPA]
[client+server] random SPA port (tcp/22 ssh) test):
==24257== 17 bytes in 1 blocks are definitely lost in loss record 1 of 1
==24257== at 0x4C2B3F8: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==24257== by 0x4E38B9B: fko_set_rand_value (fko_rand_value.c:114)
==24257== by 0x4E37FE0: fko_new (fko_funcs.c:75)
==24257== by 0x10AE52: main (fwknop.c:113)
if(strnlen(new_val, FKO_RAND_VAL_SIZE+1) != FKO_RAND_VAL_SIZE)
return(FKO_ERROR_INVALID_DATA);
+ if(ctx->rand_val != NULL)
+ free(ctx->rand_val);
+
ctx->rand_val = strdup(new_val);
if(ctx->rand_val == NULL)
return(FKO_ERROR_MEMORY_ALLOCATION);
srand(seed);
+ if(ctx->rand_val != NULL)
+ free(ctx->rand_val);
+
ctx->rand_val = malloc(FKO_RAND_VAL_SIZE+1);
if(ctx->rand_val == NULL)
return(FKO_ERROR_MEMORY_ALLOCATION);