Add a missing free in the error path.
authorlteo <lteo@openbsd.org>
Tue, 28 Apr 2015 02:26:43 +0000 (02:26 +0000)
committerlteo <lteo@openbsd.org>
Tue, 28 Apr 2015 02:26:43 +0000 (02:26 +0000)
ok nicm@

usr.bin/file/file.c

index 7f7cabe..0c2707d 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.36 2015/04/27 13:52:17 nicm Exp $ */
+/* $OpenBSD: file.c,v 1.37 2015/04/28 02:26:43 lteo Exp $ */
 
 /*
  * Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
@@ -301,6 +301,7 @@ read_link(struct input_msg *msg, const char *path)
                            "%s/%s", root, lpath);
                        if (used < 0 || (size_t)used >= sizeof msg->link_path) {
                                msg->link_error = ENAMETOOLONG;
+                               free(copy);
                                return;
                        }
                }