]>
Commit | Line | Data |
---|---|---|
59ab3540 AM |
1 | To: vim_dev@googlegroups.com |
2 | Subject: Patch 7.3.349 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.3.349 | |
11 | Problem: When running out of memory during startup trying to open a | |
12 | swapfile will loop forever. | |
13 | Solution: Let findswapname() set dirp to NULL if out of memory. | |
14 | Files: src/memline.c | |
15 | ||
16 | ||
17 | *** ../vim-7.3.348/src/memline.c 2011-06-13 01:07:22.000000000 +0200 | |
18 | --- src/memline.c 2011-10-26 11:26:06.000000000 +0200 | |
19 | *************** | |
20 | *** 621,626 **** | |
21 | --- 621,628 ---- | |
22 | break; | |
23 | fname = findswapname(buf, &dirp, mfp->mf_fname); | |
24 | /* alloc's fname */ | |
25 | + if (dirp == NULL) /* out of memory */ | |
26 | + break; | |
27 | if (fname == NULL) /* no file name found for this dir */ | |
28 | continue; | |
29 | ||
30 | *************** | |
31 | *** 744,749 **** | |
32 | --- 746,753 ---- | |
33 | * and creating it, another Vim creates the file. In that case the | |
34 | * creation will fail and we will use another directory. */ | |
35 | fname = findswapname(buf, &dirp, NULL); /* allocates fname */ | |
36 | + if (dirp == NULL) | |
37 | + break; /* out of memory */ | |
38 | if (fname == NULL) | |
39 | continue; | |
40 | if (mf_open_file(mfp, fname) == OK) /* consumes fname! */ | |
41 | *************** | |
42 | *** 4114,4119 **** | |
43 | --- 4118,4124 ---- | |
44 | * | |
45 | * Several names are tried to find one that does not exist | |
46 | * Returns the name in allocated memory or NULL. | |
47 | + * When out of memory "dirp" is set to NULL. | |
48 | * | |
49 | * Note: If BASENAMELEN is not correct, you will get error messages for | |
50 | * not being able to open the swap or undo file | |
51 | *************** | |
52 | *** 4157,4163 **** | |
53 | * First allocate some memory to put the directory name in. | |
54 | */ | |
55 | dir_name = alloc((unsigned)STRLEN(*dirp) + 1); | |
56 | ! if (dir_name != NULL) | |
57 | (void)copy_option_part(dirp, dir_name, 31000, ","); | |
58 | ||
59 | /* | |
60 | --- 4162,4170 ---- | |
61 | * First allocate some memory to put the directory name in. | |
62 | */ | |
63 | dir_name = alloc((unsigned)STRLEN(*dirp) + 1); | |
64 | ! if (dir_name == NULL) | |
65 | ! *dirp = NULL; | |
66 | ! else | |
67 | (void)copy_option_part(dirp, dir_name, 31000, ","); | |
68 | ||
69 | /* | |
70 | *** ../vim-7.3.348/src/version.c 2011-10-26 11:40:56.000000000 +0200 | |
71 | --- src/version.c 2011-10-26 11:43:05.000000000 +0200 | |
72 | *************** | |
73 | *** 716,717 **** | |
74 | --- 716,719 ---- | |
75 | { /* Add new patch number below this line */ | |
76 | + /**/ | |
77 | + 349, | |
78 | /**/ | |
79 | ||
80 | -- | |
81 | I AM THANKFUL... | |
82 | ...for all the complaining I hear about the government | |
83 | because it means we have freedom of speech. | |
84 | ||
85 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
86 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
87 | \\\ an exciting new programming language -- http://www.Zimbu.org /// | |
88 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |