aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDataStorage.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-02-19 01:18:33 +0000
committerrowanbeentje <rowan@beent.je>2010-02-19 01:18:33 +0000
commitdc2f4652e24c76c4eac74eab1a3d8bcca923b2ca (patch)
tree77bf33f58964f59af5ae946a5006939cc718224b /Source/SPDataStorage.m
parent414e419e7cc3b5a5600a1629c2d7caf606132e91 (diff)
downloadsequelpro-dc2f4652e24c76c4eac74eab1a3d8bcca923b2ca.tar.gz
sequelpro-dc2f4652e24c76c4eac74eab1a3d8bcca923b2ca.tar.bz2
sequelpro-dc2f4652e24c76c4eac74eab1a3d8bcca923b2ca.zip
- Fix a data storage incorrect reassignment after a realloc - cause of source view changes/content view update crashes, and almost certainly memory leaks and other crashes
Diffstat (limited to 'Source/SPDataStorage.m')
-rw-r--r--Source/SPDataStorage.m9
1 files changed, 4 insertions, 5 deletions
diff --git a/Source/SPDataStorage.m b/Source/SPDataStorage.m
index 65153d2b..2da99409 100644
--- a/Source/SPDataStorage.m
+++ b/Source/SPDataStorage.m
@@ -339,12 +339,11 @@ static inline void SPDataStorageEnsureCapacityForAdditionalRowCount(SPDataStorag
// If the new column count is higher than the old count, iterate through the existing rows
// and pad with nils
if (columnCount > numColumns) {
- while (i > 0) {
- row = dataStorage[--i];
- row = (id *)realloc(row, columnPointerByteSize);
+ while (i-- > 0) {
+ dataStorage[i] = (id *)realloc(dataStorage[i], columnPointerByteSize);
j = numColumns;
while (j < columnCount) {
- row[j++] = nil;
+ dataStorage[i][j++] = nil;
}
}
@@ -357,7 +356,7 @@ static inline void SPDataStorageEnsureCapacityForAdditionalRowCount(SPDataStorag
while (j > columnCount) {
if (row[--j]) CFRelease(row[j]);
}
- row = (id *)realloc(row, columnPointerByteSize);
+ dataStorage[i] = (id *)realloc(row, columnPointerByteSize);
}
}
}