bc-1.06.95-memleak.patch 682 B

123456789101112131415161718192021222324252627
  1. diff --git a/bc/bc.y b/bc/bc.y
  2. index 14dc4be..bd91c38 100644
  3. --- a/bc/bc.y
  4. +++ b/bc/bc.y
  5. @@ -569,6 +569,7 @@ expression : named_expression ASSIGN_OP
  6. generate (">");
  7. break;
  8. }
  9. + free($2);
  10. }
  11. | expression '+' expression
  12. {
  13. diff --git a/bc/util.c b/bc/util.c
  14. index 30beaf9..26e2e85 100644
  15. --- a/bc/util.c
  16. +++ b/bc/util.c
  17. @@ -602,8 +602,7 @@ lookup (name, namekind)
  18. case FUNCTDEF:
  19. if (id->f_name != 0)
  20. {
  21. - if (namekind != FUNCT)
  22. - free(name);
  23. + free(name);
  24. /* Check to see if we are redefining a math lib function. */
  25. if (use_math && namekind == FUNCTDEF && id->f_name <= 6)
  26. id->f_name = next_func++;