Avoid a memory leak. sync
authorNeal H. Walfield <neal@pep.foundation>
Sat, 23 Nov 2019 19:31:47 +0100
branchsync
changeset 42131ead4413faca
parent 4212 aa401cd071d1
child 4214 0273518aad5f
Avoid a memory leak.
src/pgp_sequoia.c
     1.1 --- a/src/pgp_sequoia.c	Sat Nov 23 17:45:30 2019 +0100
     1.2 +++ b/src/pgp_sequoia.c	Sat Nov 23 19:31:47 2019 +0100
     1.3 @@ -251,8 +251,10 @@
     1.4  
     1.5  	int r = snprintf(path, path_size, "%s" PEP_KEYS_PATH, home_env);
     1.6      assert(r >= 0 && r < path_size);
     1.7 -    if (r < 0)
     1.8 +    if (r < 0) {
     1.9 +        free(path);
    1.10          ERROR_OUT(NULL, PEP_UNKNOWN_ERROR, "snprintf");
    1.11 +    }
    1.12  
    1.13      int sqlite_result;
    1.14      sqlite_result = sqlite3_open_v2(path,