aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-11-27 00:42:39 +0000
committerGravatar arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-11-27 00:42:39 +0000
commit5fe4cdbdd07655f2beb72a45739b6724a183098d (patch)
tree53de29e0750271592ebc2c387a5288ceca2deb5f
parent3a6d1b8c4dfb289168abc0e9ee088c8edef8376c (diff)
bad malloc+strcpy => strdup
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3151 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--libmpdemux/demuxer.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c
index c03d49ccba..0beddd505e 100644
--- a/libmpdemux/demuxer.c
+++ b/libmpdemux/demuxer.c
@@ -2,6 +2,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#include <sys/types.h>
@@ -654,8 +655,7 @@ int demux_info_add(demuxer_t *demuxer, char *opt, char *param)
mp_msg(MSGT_DEMUX, MSGL_WARN, "Demuxer info->name already present\n!");
return(0);
}
- info->name = malloc(strlen(param));
- strcpy(info->name, param);
+ info->name = strdup(param);
return(1);
}
@@ -666,8 +666,7 @@ int demux_info_add(demuxer_t *demuxer, char *opt, char *param)
mp_msg(MSGT_DEMUX, MSGL_WARN, "Demuxer info->author already present\n!");
return(0);
}
- info->author = malloc(strlen(param));
- strcpy(info->author, param);
+ info->author = strdup(param);
return(1);
}
@@ -678,8 +677,7 @@ int demux_info_add(demuxer_t *demuxer, char *opt, char *param)
mp_msg(MSGT_DEMUX, MSGL_WARN, "Demuxer info->encoder already present\n!");
return(0);
}
- info->encoder = malloc(strlen(param));
- strcpy(info->encoder, param);
+ info->encoder = strdup(param);
return(1);
}
@@ -690,8 +688,7 @@ int demux_info_add(demuxer_t *demuxer, char *opt, char *param)
mp_msg(MSGT_DEMUX, MSGL_WARN, "Demuxer info->comments already present\n!");
return(0);
}
- info->comments = malloc(strlen(param));
- strcpy(info->comments, param);
+ info->comments = strdup(param);
return(1);
}
@@ -702,8 +699,7 @@ int demux_info_add(demuxer_t *demuxer, char *opt, char *param)
mp_msg(MSGT_DEMUX, MSGL_WARN, "Demuxer info->copyright already present\n!");
return(0);
}
- info->copyright = malloc(strlen(param));
- strcpy(info->copyright, param);
+ info->copyright = strdup(param);
return(1);
}