]> granicus.if.org Git - postgresql/commitdiff
Fix possible NULL dereference in ExecAlterObjectDependsStmt
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Sun, 10 Apr 2016 14:03:35 +0000 (11:03 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Sun, 10 Apr 2016 14:03:35 +0000 (11:03 -0300)
I used the wrong variable here.  Doesn't make a difference today because
the only plausible caller passes a non-NULL variable, but someday it
will be wrong, and even today's correctness is subtle: the caller that
does pass a NULL is never invoked because of object type constraints.
Surely not a condition to rely on.

Noted by Coverity

src/backend/commands/alter.c

index 27b757959280f0f6711f43067ea080659e5b6ee6..47a5c5013207f2c7a5d9bbe11ca5ae2599afc311 100644 (file)
@@ -422,7 +422,7 @@ ExecAlterObjectDependsStmt(AlterObjectDependsStmt *stmt, ObjectAddress *refAddre
        if (refAddress)
                *refAddress = refAddr;
 
-       recordDependencyOn(&address, refAddress, DEPENDENCY_AUTO_EXTENSION);
+       recordDependencyOn(&address, &refAddr, DEPENDENCY_AUTO_EXTENSION);
 
        return address;
 }