Avoid possible dereference null pointer (src/backend/catalog/pg_depend.c) - Mailing list pgsql-hackers

From Ranier Vilela
Subject Avoid possible dereference null pointer (src/backend/catalog/pg_depend.c)
Date
Msg-id CAEudQAqh_RZqoFcYKso5d9VhF-Vd64_ZodfQ_2zSusszkEmyRg@mail.gmail.com
Whole thread Raw
Responses Re: Avoid possible dereference null pointer (src/backend/catalog/pg_depend.c)
List pgsql-hackers
Hi.

Per Coverity.
     
2. returned_null: SearchSysCacheAttName returns NULL (checked 20 out of 21 times).
3. var_assigned: Assigning: ptup = NULL return value from SearchSysCacheAttName.
 964                ptup = SearchSysCacheAttName(relidattname);
CID 1545986: (#1 of 1): Dereference null return value (NULL_RETURNS)
4. dereference: Dereferencing ptup, which is known to be NULL.

The functions SearchSysCacheAttNum and SearchSysCacheAttName,
need to have the result checked.

The commit 5091995, left an oversight.

Fixed by the patch attached, a change of style, unfortunately, was necessary.

best regards,
Ranier Vilela
Attachment

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: State of pg_createsubscriber
Next
From: Robert Haas
Date:
Subject: Re: Avoid orphaned objects dependencies, take 3