Panu Matilainen 804834
commit f895acd285366cf58cc3c97b5f188fecbfd782a8
Panu Matilainen 804834
Author: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen 804834
Date:   Mon Jan 4 12:20:09 2010 +0200
Panu Matilainen 804834
Panu Matilainen 804834
    Always free locally defined macros when they go out of scope
Panu Matilainen 804834
    - Prior to this, local defines in constructs like %{!?foo: %define foo bar}
Panu Matilainen 804834
      would remain defined until a parametrized macro gets called, causing
Panu Matilainen 804834
      obscure and confusing errors in specs such as RhBug:551971 and countless
Panu Matilainen 804834
      others. Use of %global is now always required for such constructs.
Panu Matilainen 804834
Panu Matilainen 804834
diff --git a/rpmio/macro.c b/rpmio/macro.c
Panu Matilainen 804834
index 88fb583..11db47d 100644
Panu Matilainen 804834
--- a/rpmio/macro.c
Panu Matilainen 804834
+++ b/rpmio/macro.c
Panu Matilainen 804834
@@ -1344,9 +1344,8 @@ expandMacro(MacroBuf mb)
Panu Matilainen 804834
 			me->used++;	/* Mark macro as used */
Panu Matilainen 804834
 	}
Panu Matilainen 804834
 
Panu Matilainen 804834
-	/* Free args for "%name " macros with opts */
Panu Matilainen 804834
-	if (me->opts != NULL)
Panu Matilainen 804834
-		freeArgs(mb);
Panu Matilainen 804834
+	/* Free locally defined macros, such as macro options */
Panu Matilainen 804834
+	freeArgs(mb);
Panu Matilainen 804834
 
Panu Matilainen 804834
 	s = se;
Panu Matilainen 804834
     }