kernel/scripts/recordmcount.c
.. .. @@ -102,6 +102,7 @@ 102 102 { 103 103 size_t cnt = count; 104 104 off_t idx = 0; 105 + void *p = NULL;105 106 106 107 file_updated = 1; 107 108 .. .. @@ -109,7 +110,10 @@ 109 110 off_t aoffset = (file_ptr + count) - file_end; 110 111 111 112 if (aoffset > file_append_size) { 112 - file_append = realloc(file_append, aoffset);113 + p = realloc(file_append, aoffset);114 + if (!p)115 + free(file_append);116 + file_append = p;113 117 file_append_size = aoffset; 114 118 } 115 119 if (!file_append) {