Overview
Comment: | Corrected memory leaks in CVFS |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
56c0612e71661df93ce12b73247697c8 |
User & Date: | rkeene on 2014-11-14 21:43:47 |
Other Links: | manifest | tags |
Context
2014-11-17
| ||
18:43 | Updated order of Incr/Decr in CVFS for consistency check-in: dfa8940a62 user: rkeene tags: trunk | |
2014-11-14
| ||
21:43 | Corrected memory leaks in CVFS check-in: 56c0612e71 user: rkeene tags: trunk | |
2014-11-13
| ||
18:03 | Updated 8.6 builds to 8.6.3 check-in: 02c667ab97 user: rkeene tags: trunk | |
Changes
Modified kitsh/buildsrc/kitsh-0.0/cvfs_data.c from [dcf0f1a5fd] to [2f0d8b57ce].
︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | + | cmd_getData_t *cmd_getData; cmd_getChildren_t *cmd_getChildren; struct cvfs_data *finfo = NULL; Tcl_Obj *ret_list, *ret_list_items[20]; unsigned long num_children; const char *hashkey; const char *file; int idx; if (objc != 3) { Tcl_SetResult(interp, "wrong # args: should be \"getMetadata hashKey fileName\"", TCL_STATIC); return(TCL_ERROR); } |
︙ | |||
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | + + + + + + + + + + + + | ret_list_items[15] = Tcl_NewStringObj("0", 1); ret_list_items[16] = Tcl_NewStringObj("mtime", 5); ret_list_items[17] = Tcl_NewStringObj("0", 1); ret_list_items[18] = Tcl_NewStringObj("ctime", 5); ret_list_items[19] = Tcl_NewStringObj("0", 1); for (idx = 0; idx < (sizeof(ret_list_items) / sizeof(ret_list_items[0])); idx++) { Tcl_IncrRefCount(ret_list_items[idx]); } ret_list = Tcl_NewListObj(sizeof(ret_list_items) / sizeof(ret_list_items[0]), ret_list_items); Tcl_IncrRefCount(ret_list); for (idx = 0; idx < (sizeof(ret_list_items) / sizeof(ret_list_items[0])); idx++) { Tcl_DecrRefCount(ret_list_items[idx]); } Tcl_SetObjResult(interp, ret_list); Tcl_DecrRefCount(ret_list); return(TCL_OK); } static int getData(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { struct cvfs_data *finfo = NULL; cmd_getData_t *cmd_getData; |
︙ | |||
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | + + + + | if (end < start) { Tcl_SetResult(interp, "Invalid arguments, start must be less than end", TCL_STATIC); return(TCL_ERROR); } ret_str = Tcl_NewByteArrayObj(finfo->data + start, (end - start)); Tcl_IncrRefCount(ret_str); Tcl_SetObjResult(interp, ret_str); Tcl_DecrRefCount(ret_str); return(TCL_OK); } static int getChildren(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { struct cvfs_data *finfo = NULL; cmd_getChildren_t *cmd_getChildren; |
︙ | |||
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | + + + + + + + + | ret_list = Tcl_NewObj(); if (ret_list == NULL) { Tcl_SetResult(interp, "Failed to allocate new object", TCL_STATIC); return(TCL_ERROR); } Tcl_IncrRefCount(ret_list); children = malloc(sizeof(*children) * num_children); num_children = cmd_getChildren(file, children, num_children); for (idx = 0; idx < num_children; idx++) { finfo = cmd_getData(NULL, children[idx]); if (finfo == NULL || finfo->name == NULL) { continue; } child = finfo->name; ret_curr_obj = Tcl_NewStringObj(child, strlen(child)); Tcl_IncrRefCount(ret_curr_obj); Tcl_ListObjAppendList(interp, ret_list, ret_curr_obj); Tcl_DecrRefCount(ret_curr_obj); } free(children); Tcl_SetObjResult(interp, ret_list); Tcl_DecrRefCount(ret_list); return(TCL_OK); } |