Changeset 247 for trunk/src/slib.c
- Timestamp:
- Sep 17, 2009, 10:22:48 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/slib.c
r243 r247 1674 1674 if ( (ofiles[fd]->path = (char *) malloc(len) ) == NULL) 1675 1675 { 1676 free (ofiles[fd]);1676 free (ofiles[fd]); 1677 1677 ofiles[fd] = NULL; 1678 1678 SL_IRETURN(SL_EMEM, _("sl_make_ticket")); … … 1687 1687 (void) free (ofiles[fd]->path); 1688 1688 (void) free (ofiles[fd]); 1689 ofiles[fd] = NULL; 1689 1690 SL_IRETURN(ticket, _("sl_make_ticket")); 1690 1691 } … … 1935 1936 if ( (ofiles[fd]->path = (char *) malloc(len) ) == NULL) 1936 1937 { 1937 free (ofiles[fd]);1938 free (ofiles[fd]); 1938 1939 ofiles[fd] = NULL; 1939 1940 close(fd); … … 1949 1950 (void) free (ofiles[fd]->path); 1950 1951 (void) free (ofiles[fd]); 1952 ofiles[fd] = NULL; 1951 1953 close(fd); 1952 1954 SL_IRETURN(ticket, _("sl_open_file")); … … 2209 2211 SL_IRETURN(fd, _("sl_close")); 2210 2212 2213 if (ofiles[fd] != NULL) 2214 { 2211 2215 #if defined(HAVE_POSIX_FADVISE) && defined(HAVE_MINCORE) && defined(POSIX_FADV_DONTNEED) 2212 2213 if (ofiles[fd]->flush == SL_TRUE) 2214 { 2215 posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED); 2216 } 2217 2218 #endif 2216 if (ofiles[fd]->flush == SL_TRUE) 2217 { 2218 posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED); 2219 } 2220 #endif 2221 if (ofiles[fd]->content) 2222 sh_string_destroy(&(ofiles[fd]->content)); 2223 (void) free (ofiles[fd]->path); 2224 (void) free (ofiles[fd]); 2225 ofiles[fd] = NULL; 2226 } 2219 2227 2220 2228 /* This may fail, but what to do then ? 2221 2229 */ 2222 if (0 != close(fd) && ofiles[fd] != NULL)2230 if (0 != close(fd)) 2223 2231 { 2224 2232 TPT((0, FIL__, __LINE__, 2225 _("msg=<Error closing file.>, path=<%s>, fd=<%d>, err=<%s>\n"), 2226 ofiles[fd]->path, fd, strerror(errno))); 2227 } 2228 2229 if (ofiles[fd] != NULL) 2230 { 2231 if (ofiles[fd]->content) 2232 sh_string_destroy(&(ofiles[fd]->content)); 2233 (void) free(ofiles[fd]->path); 2234 (void) free(ofiles[fd]); 2235 ofiles[fd] = NULL; 2233 _("msg=<Error closing file.>, fd=<%d>, err=<%s>\n"), 2234 fd, strerror(errno))); 2236 2235 } 2237 2236 … … 2248 2247 sh_string_destroy(&(ofiles[fd]->content)); 2249 2248 if (ofiles[fd]->path != NULL) 2250 (void) free (ofiles[fd]->path);2251 (void) free (ofiles[fd]);2249 (void) free (ofiles[fd]->path); 2250 (void) free (ofiles[fd]); 2252 2251 ofiles[fd] = NULL; 2253 2252 }
Note:
See TracChangeset
for help on using the changeset viewer.