File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -674,6 +674,7 @@ int is_macvtap(const char *ifname)
674674{
675675 int ret , s , realsize ;
676676 struct nlmsghdr * nlh ;
677+ struct nlmsghdr * temp ;
677678 struct ifinfomsg * ifinfo ;
678679 struct nlattr * tb [IFLA_MAX + 1 ],
679680 * tb2 [IFLA_INFO_MAX + 1 ];
@@ -708,16 +709,15 @@ int is_macvtap(const char *ifname)
708709 realsize = recv (s , NULL , 0 , MSG_DONTWAIT | MSG_PEEK | MSG_TRUNC );
709710 } while ((realsize < 0 ) && errno == EINTR );
710711
711- if (realsize <= 0 ) {
712+ if (realsize < 0 ) {
712713 goto out_free ;
713714 }
714715
715- free (nlh );
716- nlh = calloc (1 , realsize );
717-
718- if (!nlh ) {
719- goto out ;
716+ temp = realloc (nlh , realsize );
717+ if (!temp ) {
718+ goto out_free ;
720719 }
720+ nlh = temp ;
721721
722722 do {
723723 ret = recv (s , (void * ) nlh , realsize , MSG_DONTWAIT );
You can’t perform that action at this time.
0 commit comments