Fix a logic error leading to unlink(NULL) call, oops.
authorPanu Matilainen <pmatilai@redhat.com>
Mon, 30 May 2011 12:54:16 +0000 (15:54 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Mon, 30 May 2011 12:54:16 +0000 (15:54 +0300)
- If writing the scriptlet to a file fails, its possible to
  end up with non-NULL script but with NULL fn and kaboom in unlink()

lib/rpmscript.c

index 6580a52..1d5ed4e 100644 (file)
@@ -280,7 +280,7 @@ exit:
     if (out)
        Fclose(out);    /* XXX dup'd STDOUT_FILENO */
 
-    if (script) {
+    if (fn) {
        if (!rpmIsDebug())
            unlink(fn);
        free(fn);