diff options
author | Thomas White <taw@physics.org> | 2016-04-01 13:33:41 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2016-04-01 13:33:41 +0200 |
commit | 52a9c0b1a891f2adfbcdbe4d69b070e837b8e7cb (patch) | |
tree | d96349f37a6f1985c975d7a44211c2b0b893c7f0 /libcrystfel | |
parent | 4a4d3dedf618656f55c3e268b08fa5c987ee8ba8 (diff) |
Fix silly bugs and tidy up
Diffstat (limited to 'libcrystfel')
-rw-r--r-- | libcrystfel/src/events.c | 11 | ||||
-rw-r--r-- | libcrystfel/src/hdf5-file.c | 1 |
2 files changed, 5 insertions, 7 deletions
diff --git a/libcrystfel/src/events.c b/libcrystfel/src/events.c index f1eda408..8d059528 100644 --- a/libcrystfel/src/events.c +++ b/libcrystfel/src/events.c @@ -574,9 +574,9 @@ char *event_path_placeholder_subst(const char *entry, const char *data) assert(len_head >= 0); strncpy(full_path, data, len_head); + full_path[len_head] = '\0'; strcat(full_path, entry); strcat(full_path, ph_loc+1); - full_path[len_data + len_entry] = '\0'; return full_path; } @@ -591,13 +591,12 @@ char *retrieve_full_path(struct event *ev, const char *data) for ( ei=0; ei<ev->path_length; ei++ ) { - char *tmp_subst_data; - tmp_subst_data = event_path_placeholder_subst(ev->path_entries[ei], - return_value); + char *tmp; + tmp = event_path_placeholder_subst(ev->path_entries[ei], + return_value); free(return_value); - return_value = strdup(tmp_subst_data); - free(tmp_subst_data); + return_value = tmp; } diff --git a/libcrystfel/src/hdf5-file.c b/libcrystfel/src/hdf5-file.c index a57719cf..f717d527 100644 --- a/libcrystfel/src/hdf5-file.c +++ b/libcrystfel/src/hdf5-file.c @@ -468,7 +468,6 @@ int get_peaks(struct image *image, struct hdfile *f, const char *p) if ( image->event != NULL ) { np = retrieve_full_path(image->event, p); - free(np); } else { np = strdup(p); } |