diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2014-03-24 23:20:13 +0000 |
|---|---|---|
| committer | Johan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl> | 2014-03-24 23:20:13 +0000 |
| commit | 19a740b9617ef96a571b6dce3cf5aec2bae2d47c (patch) | |
| tree | b467519b87475ca30e620c81bebe09aa42869a28 /src/unicoderange.cpp | |
| parent | fix tiny mistake (diff) | |
| download | inkscape-19a740b9617ef96a571b6dce3cf5aec2bae2d47c.tar.gz inkscape-19a740b9617ef96a571b6dce3cf5aec2bae2d47c.zip | |
fix memory allocation bug (thanks to clang's static analyzer scan-build)
(bzr r13205)
Diffstat (limited to '')
| -rw-r--r-- | src/unicoderange.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/unicoderange.cpp b/src/unicoderange.cpp index 803e1a884..5a9c4b331 100644 --- a/src/unicoderange.cpp +++ b/src/unicoderange.cpp @@ -39,7 +39,7 @@ int UnicodeRange::add_range(gchar* val){ while(val[i]!='\0' && val[i]!='-' && val[i]!=' ' && val[i]!=','){ i++; } - r.start = (gchar*) malloc((i+1)*sizeof(gchar*)); + r.start = (gchar*) malloc((i+1)*sizeof(gchar)); strncpy(r.start, val, i); r.start[i] = '\0'; val+=i; @@ -48,7 +48,7 @@ int UnicodeRange::add_range(gchar* val){ if (val[0]=='-'){ val++; while(val[i]!='\0' && val[i]!='-' && val[i]!=' ' && val[i]!=',') i++; - r.end = (gchar*) malloc((i+1)*sizeof(gchar*)); + r.end = (gchar*) malloc((i+1)*sizeof(gchar)); strncpy(r.end, val, i); r.end[i] = '\0'; // val+=i; |
