Print this page
6139 help gcc figure out variable initialization


 808                 portalArray = iscsit_zalloc(tpg->tpg_portal_count *
 809                     sizeof (it_portal_t));
 810                 if (portalArray == NULL) {
 811                         nvlist_free(*nvl);
 812                         *nvl = NULL;
 813                         return (ENOMEM);
 814                 }
 815 
 816                 i = 0;
 817                 ptr = tpg->tpg_portal_list;
 818 
 819                 while (ptr && (i < tpg->tpg_portal_count)) {
 820                         ret = sockaddr_to_str(&(ptr->portal_addr),
 821                             &(portalArray[i]));
 822                         if (ret != 0) {
 823                                 break;
 824                         }
 825                         ptr = ptr->portal_next;
 826                         i++;
 827                 }
 828         }
 829 
 830         if ((ret == 0) && portalArray) {
 831                 ret = nvlist_add_string_array(*nvl, "portalList",
 832                     portalArray, i);
 833         }
 834 
 835 
 836         if (portalArray) {
 837                 while (--i >= 0) {
 838                         if (portalArray[i]) {
 839                                 iscsit_free(portalArray[i],
 840                                     strlen(portalArray[i] + 1));
 841                         }
 842                 }
 843                 iscsit_free(portalArray,
 844                     tpg->tpg_portal_count * sizeof (it_portal_t));
 845         }
 846 
 847         if (ret != 0) {
 848                 nvlist_free(*nvl);
 849                 *nvl = NULL;
 850         }
 851 
 852         return (ret);
 853 }
 854 #endif /* !_KERNEL */
 855 
 856 int




 808                 portalArray = iscsit_zalloc(tpg->tpg_portal_count *
 809                     sizeof (it_portal_t));
 810                 if (portalArray == NULL) {
 811                         nvlist_free(*nvl);
 812                         *nvl = NULL;
 813                         return (ENOMEM);
 814                 }
 815 
 816                 i = 0;
 817                 ptr = tpg->tpg_portal_list;
 818 
 819                 while (ptr && (i < tpg->tpg_portal_count)) {
 820                         ret = sockaddr_to_str(&(ptr->portal_addr),
 821                             &(portalArray[i]));
 822                         if (ret != 0) {
 823                                 break;
 824                         }
 825                         ptr = ptr->portal_next;
 826                         i++;
 827                 }

 828 
 829                 if (ret == 0) {
 830                         ret = nvlist_add_string_array(*nvl, "portalList",
 831                             portalArray, i);
 832                 }
 833 
 834 

 835                 while (--i >= 0) {
 836                         if (portalArray[i]) {
 837                                 iscsit_free(portalArray[i],
 838                                     strlen(portalArray[i] + 1));
 839                         }
 840                 }
 841                 iscsit_free(portalArray,
 842                     tpg->tpg_portal_count * sizeof (it_portal_t));
 843         }
 844 
 845         if (ret != 0) {
 846                 nvlist_free(*nvl);
 847                 *nvl = NULL;
 848         }
 849 
 850         return (ret);
 851 }
 852 #endif /* !_KERNEL */
 853 
 854 int