]> diplodocus.org Git - nmh/commitdiff
ali: Fix a memory leak spotted by valgrind.
authorRalph Corderoy <ralph@inputplus.co.uk>
Mon, 31 Oct 2016 18:36:19 +0000 (18:36 +0000)
committerRalph Corderoy <ralph@inputplus.co.uk>
Tue, 1 Nov 2016 00:18:36 +0000 (00:18 +0000)
uip/ali.c

index 4d73afa..1f725da 100644 (file)
--- a/uip/ali.c
+++ b/uip/ali.c
@@ -143,9 +143,13 @@ main (int argc, char **argv)
        } else {
            /* print them all */
            for (ak = akahead; ak; ak = ak->ak_next) {
        } else {
            /* print them all */
            for (ak = akahead; ak; ak = ak->ak_next) {
+                char *res;
+
                printf ("%s: ", ak->ak_name);
                pos += strlen (ak->ak_name) + 1;
                printf ("%s: ", ak->ak_name);
                pos += strlen (ak->ak_name) + 1;
-               print_aka (akresult (ak), list, pos);
+                res = akresult(ak);
+               print_aka(res, list, pos);
+                free(res);
            }
        }
     }
            }
        }
     }