Always free locally defined macros when they go out of scope
authorPanu Matilainen <pmatilai@redhat.com>
Mon, 4 Jan 2010 10:20:09 +0000 (12:20 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Mon, 4 Jan 2010 10:45:18 +0000 (12:45 +0200)
- Prior to this, local defines in constructs like %{!?foo: %define foo bar}
  would remain defined until a parametrized macro gets called, causing
  obscure and confusing errors in specs such as RhBug:551971 and countless
  others. Use of %global is now always required for such constructs.

rpmio/macro.c

index 88fb583..11db47d 100644 (file)
@@ -1344,9 +1344,8 @@ expandMacro(MacroBuf mb)
                        me->used++;     /* Mark macro as used */
        }
 
-       /* Free args for "%name " macros with opts */
-       if (me->opts != NULL)
-               freeArgs(mb);
+       /* Free locally defined macros, such as macro options */
+       freeArgs(mb);
 
        s = se;
     }