X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=common%2Fmiiphyutil.c;h=7e41957185072123a81468309081ec4586730867;hb=eb04ab3492297941b285ff552645cc1c0ed72edb;hp=e499b588368fd9dcf9f04a6619976923e9d30a53;hpb=cb6baca77bca0ef999203a7ed73bd123e7da062e;p=oweals%2Fu-boot.git diff --git a/common/miiphyutil.c b/common/miiphyutil.c index e499b58836..7e41957185 100644 --- a/common/miiphyutil.c +++ b/common/miiphyutil.c @@ -114,6 +114,8 @@ void miiphy_register(const char *name, if (new_dev == NULL || ldev == NULL) { printf("miiphy_register: cannot allocate memory for '%s'\n", name); + free(ldev); + mdio_free(new_dev); return; } @@ -159,7 +161,7 @@ void mdio_free(struct mii_dev *bus) int mdio_register(struct mii_dev *bus) { - if (!bus || !bus->name || !bus->read || !bus->write) + if (!bus || !bus->read || !bus->write) return -1; /* check if we have unique name */