]> granicus.if.org Git - sudo/commitdiff
In timestamp_open() no need to free cookie on error, it is NULL.
authorTodd C. Miller <Todd.Miller@sudo.ws>
Fri, 19 Oct 2018 19:32:24 +0000 (13:32 -0600)
committerTodd C. Miller <Todd.Miller@sudo.ws>
Fri, 19 Oct 2018 19:32:24 +0000 (13:32 -0600)
Found by PVS-Studio.

plugins/sudoers/timestamp.c

index 7a854a35a6fbb7d6e6a112a71048e49edb99018a..511029d825b9170a068d19ce65d5c13654cf1f59 100644 (file)
@@ -412,7 +412,7 @@ ts_init_key_nonglobal(struct timestamp_entry *entry, struct passwd *pw, int flag
 void *
 timestamp_open(const char *user, pid_t sid)
 {
-    struct ts_cookie *cookie = NULL;
+    struct ts_cookie *cookie;
     char *fname = NULL;
     int tries, fd = -1;
     debug_decl(timestamp_open, SUDOERS_DEBUG_AUTH)
@@ -485,7 +485,6 @@ timestamp_open(const char *user, pid_t sid)
 bad:
     if (fd != -1)
        close(fd);
-    free(cookie);
     free(fname);
     debug_return_ptr(NULL);
 }