Changeset bbda5ab in mainline
- Timestamp:
- 2010-04-18T12:15:18Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e1b6742
- Parents:
- 3d482e0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/sysinfo.c
r3d482e0 rbbda5ab 103 103 in common cases. */ 104 104 105 void *data = NULL; 106 105 107 while (true) { 106 108 /* Get the binary data size */ 107 109 int ret = sysinfo_get_data_size(path, size); 108 if (ret != EOK) { 109 /* Not binary data item */ 110 return NULL; 110 if ((ret != EOK) || (size == 0)) { 111 /* Not a binary data item 112 or an empty item */ 113 break; 111 114 } 112 115 113 void *data = malloc(*size);116 data = realloc(data, *size); 114 117 if (data == NULL) 115 return NULL;118 break; 116 119 117 120 /* Get the data */ … … 121 124 return data; 122 125 123 /* Dispose the buffer */124 free(data);125 126 126 if (ret != ENOMEM) { 127 127 /* The failure to get the data was not caused 128 128 by wrong buffer size */ 129 return NULL;129 break; 130 130 } 131 131 } 132 133 if (data != NULL) 134 free(data); 135 136 *size = 0; 137 return NULL; 132 138 } 133 139
Note:
See TracChangeset
for help on using the changeset viewer.