Code

network: Fix free() before use
authorPavel Rochnyack <pavel2000@ngs.ru>
Fri, 21 Jul 2017 18:06:58 +0000 (01:06 +0700)
committerPavel Rochnyack <pavel2000@ngs.ru>
Fri, 21 Jul 2017 18:18:17 +0000 (01:18 +0700)
src/network.c

index 2ff09af3f9dccea1d9fa4c9d0fe8a077aff1566e..fbb42fcb5d915f5e732d65695e1d7313b94d7454 100644 (file)
@@ -1230,9 +1230,9 @@ static int parse_part_encr_aes256(sockent_t *se, /* {{{ */
                             part_size - buffer_offset,
                             /* in = */ NULL, /* in len = */ 0);
   if (err != 0) {
-    sfree(pea.username);
     ERROR("network plugin: gcry_cipher_decrypt returned: %s. Username: %s",
           gcry_strerror(err), pea.username);
+    sfree(pea.username);
     return (-1);
   }
 
@@ -1254,8 +1254,6 @@ static int parse_part_encr_aes256(sockent_t *se, /* {{{ */
   parse_packet(se, buffer + buffer_offset, payload_len, flags | PP_ENCRYPTED,
                pea.username);
 
-  /* XXX: Free pea.username?!? */
-
   /* Update return values */
   *ret_buffer = buffer + part_size;
   *ret_buffer_len = buffer_len - part_size;