[ismrmrd] 116/177: removing usage of strdup from dataset.c (my fault)

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Jan 14 20:02:09 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to annotated tag v1.1.0.beta.1
in repository ismrmrd.

commit dd456d01a2fcf9d04585247e718cb7b01c8f457d
Author: Joseph Naegele <joseph.naegele at gmail.com>
Date:   Mon Sep 29 15:25:07 2014 -0400

    removing usage of strdup from dataset.c (my fault)
---
 libsrc/dataset.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libsrc/dataset.c b/libsrc/dataset.c
index fd6b971..f5a60b9 100644
--- a/libsrc/dataset.c
+++ b/libsrc/dataset.c
@@ -601,15 +601,17 @@ int append_element(const ISMRMRD_Dataset * dset, const char * path, void * elem,
 /********************/
 int ismrmrd_init_dataset(ISMRMRD_Dataset *dset, const char *filename, const char *groupname) {
     if (dset) {
-        dset->filename = strdup(filename);
+        dset->filename = (char *) malloc(strlen(filename) + 1);
         if (dset->filename == NULL) {
             return ISMRMRD_PUSH_ERR(ISMRMRD_MEMORYERROR, "Failed to malloc dataset groupname");
         }
+        strcpy(dset->filename, filename);
         
-        dset->groupname = strdup(groupname);
+        dset->groupname = (char *) malloc(strlen(groupname) + 1);
         if (dset->groupname == NULL) {
             return ISMRMRD_PUSH_ERR(ISMRMRD_MEMORYERROR, "Failed to malloc dataset groupname");
         }
+        strcpy(dset->groupname, groupname);
 
         dset->fileid = 0;
         return ISMRMRD_NOERROR;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/ismrmrd.git



More information about the debian-science-commits mailing list