Displaying 20 results from an estimated 1046 matches for "strdup".
2013 Sep 05
12
[PATCH 0/5] Memory leaks amended
...39;integration-20130903''.
Gui Hecheng (5):
btrfs-progs:free local variable buf upon unsuccessful returns
btrfs-progs:local variable memory freed
btrfs-progs: missing tree-freeing statements added
btrfs-progs:free the local list pending_list in btrfs_scan_one_dir
btrfs-progs:free strdup()s that are not freed
btrfs-image.c | 2 ++
cmds-check.c | 5 +++++
cmds-subvolume.c | 48 ++++++++++++++++++++++++++++++++++--------------
mkfs.c | 12 +++++++++++-
utils.c | 10 ++++++++--
5 files changed, 60 insertions(+), 17 deletions(-)
--
1.8.0.1
--
To unsubsc...
2001 Dec 18
2
Nonportable use of strdup()
Hey, I ran across this while building vorbis on the Mac:
In libvorbis RC2, file info.c, line 65, there's a call to strdup().
strdup() isn't portable, and it looks like the code should use the
internal memory functions to create the memory for the string anyway.
Actually, on further inspection, it looks like the memory for the
user comments is never actually freed.
I'm not subscribed to the list, so please CC...
2019 Nov 26
0
[PATCH common v2 1/3] options: Simplify selector parsing for --key options.
...tions/keys.c
@@ -153,49 +153,42 @@ get_key (struct key_store *ks, const char *device)
}
struct key_store *
-key_store_add_from_selector (struct key_store *ks, const char *selector_orig)
+key_store_add_from_selector (struct key_store *ks, const char *selector)
{
- CLEANUP_FREE char *selector = strdup (selector_orig);
- const char *elem;
- char *saveptr;
+ CLEANUP_FREE_STRING_LIST char **fields =
+ guestfs_int_split_string (':', selector);
struct key_store_key key;
- if (!selector)
- error (EXIT_FAILURE, errno, "strdup");
+ if (!fields)
+ error (EXIT_FAILURE,...
2004 Jul 03
1
[LLVMdev] CommandLine.cpp:189: error: `strdup' undeclared
...ry `/usr/local/src/llvm/lib/Support'
gmake[1]: Entering directory `/usr/local/src/llvm/lib/Support'
Compiling CommandLine.cpp
CommandLine.cpp: In function `void ParseCStringVector(std::vector<char*,
std::allocator<char*> >&, const char*)':
CommandLine.cpp:189: error: `strdup' undeclared (first use this function)
CommandLine.cpp:189: error: (Each undeclared identifier is reported only
once
for each function it appears in.)
CommandLine.cpp: In function `void llvm::cl::ParseEnvironmentOptions(const
char*, const char*, const char*)':
CommandLine.cpp:230: err...
2020 Oct 16
3
[libnbd PATCH] info: Add support for new 'qemu-nbd -A' qemu:allocation-depth
A rather trivial decoding; we may enhance it further if qemu extends
things to give an integer depth alongside its tri-state encoding.
---
I'll wait to push this to libnbd until the counterpart qemu patches
land upstream, although it looks like I've got positive review.
info/nbdinfo.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/info/nbdinfo.c b/info/nbdinfo.c
index
2019 Nov 12
0
[PATCH 2/2] options: Allow multiple --key parameters and default keys.
...char *s;
- if (STRNEQ (key->device, device))
+ if (STRNEQ (key->device, "") &&
+ STRNEQ (key->device, device))
continue;
switch (key->type) {
@@ -139,63 +157,64 @@ get_key (struct key_store *ks, const char *device)
s = strdup (key->string.s);
if (!s)
error (EXIT_FAILURE, errno, "strdup");
- return s;
+ r[j++] = s;
+ break;
case key_file:
- return read_first_line_from_file (key->file.name);
+ s = read_first_line_from_file (key->file.name);
+...
2015 Jul 13
1
[PATCH] daemon: add a space after func name to fit code-style
...ADD_ARG (argv, i, "-clzo");
else {
reply_with_error ("unknown compress method: %s", compress);
@@ -1845,7 +1845,7 @@ do_btrfs_balance_status (const char *path)
}
if (strstr (lines[0], "No balance found on")) {
- ret->btrfsbalance_status = strdup("none");
+ ret->btrfsbalance_status = strdup ("none");
if (ret->btrfsbalance_status == NULL) {
reply_with_perror ("strdup");
return NULL;
@@ -1866,9 +1866,9 @@ do_btrfs_balance_status (const char *path)
#undef N_MATCH
if (STREQ (lines[...
2011 Jul 10
0
[LLVMdev] How to get line number of a function in a bitcode file?
I tried to install the SAFECode in LLVM 2.6 following the instruction in
Install.html. But when I do the step:
# cd projects/poolalloc
# make
I get the errore below:
llvm[2]: Compiling qsort.c for Release build (bytecode)
llvm[2]: Compiling strdup.c for Release build (bytecode)
llvm[2]: Compiling qsort.c for Release build
llvm[2]: Compiling strdup.c for Release build
llvm[2]: Compiling qsort.ll to qsort.bc for Release build (bytecode)
llvm[2]: Compiling strdup.ll to strdup.bc for Release build (bytecode)
/home/chenliu/llvm-2.6/llvm/Release/b...
2011 Jan 11
0
[PATCH, v2]: xl: move domain struct init functions to libxl
...libxl_uuid_generate(&uuid);
+ r = libxl_uuid_bytearray(&uuid);
+ memset(nic_info, ''\0'', sizeof(*nic_info));
+
+ nic_info->backend_domid = 0;
+ nic_info->domid = 0;
+ nic_info->devid = devnum;
+ nic_info->mtu = 1492;
+ nic_info->model = strdup("e1000");
+ nic_info->mac[0] = 0x00;
+ nic_info->mac[1] = 0x16;
+ nic_info->mac[2] = 0x3e;
+ nic_info->mac[3] = r[0] & 0x7f;
+ nic_info->mac[4] = r[1];
+ nic_info->mac[5] = r[2];
+ nic_info->ifname = NULL;
+ nic_info->bridge = strdup(&qu...
2012 Mar 18
2
malloc/calloc/strdup and R's aequivalents
Hello,
when looking at "Writing R Extensions"
with mem-allocation in mind, I wondered,
which functions to use to substitute
malloc(), calloc(), realloc() and strdup() and free().
It looked like Calloc() or R_Calloc() might be useful for
some of my tasks, but when trying to use R_Calloc() for example,
I got some error messages which I don't see where they are coming from.
Maybe I just have forgotten to includ ethe right header file?
So, how to use Calloc...
2005 Nov 01
1
[Bug 1108] strdup from openbsd-compat/bsd-misc.c is broken
http://bugzilla.mindrot.org/show_bug.cgi?id=1108
Summary: strdup from openbsd-compat/bsd-misc.c is broken
Product: Portable OpenSSH
Version: 4.2p1
Platform: All
URL: http://www.freebsd.org/cgi/query-pr.cgi?pr=87067
OS/Version: other
Status: NEW
Severity: normal
Priority: P2...
2004 Jul 02
1
[LLVMdev] CommandLine.cpp:189: error: `strdup' undeclared
...ry `/usr/local/src/llvm/lib/Support'
gmake[1]: Entering directory `/usr/local/src/llvm/lib/Support'
Compiling CommandLine.cpp
CommandLine.cpp: In function `void ParseCStringVector(std::vector<char*,
std::allocator<char*> >&, const char*)':
CommandLine.cpp:189: error: `strdup' undeclared (first use this function)
CommandLine.cpp:189: error: (Each undeclared identifier is reported only
once
for each function it appears in.)
CommandLine.cpp: In function `void llvm::cl::ParseEnvironmentOptions(const
char*, const char*, const char*)':
CommandLine.cpp:230: err...
2018 Jun 29
3
p2v: Various cleanups.
These are a prelude to fixing
https://bugzilla.redhat.com/show_bug.cgi?id=1590220
A lot of the virt-p2v configuration code was duplicated manually.
These changes make sure that most of it is generated.
Rich.
2009 Aug 11
1
[PATCH libguestfs] generator.ml: constify do_mkdtemp
...mon/dir.c
index ad1c7c9..21ae07e 100644
--- a/daemon/dir.c
+++ b/daemon/dir.c
@@ -185,31 +185,20 @@ do_is_dir (const char *path)
}
char *
-do_mkdtemp (char *template)
+do_mkdtemp (const char *template)
{
- char *r;
-
- NEED_ROOT (return NULL);
- ABS_PATH (template, return NULL);
+ char *r = strdup (template);
+ if (r == NULL) {
+ reply_with_perror ("strdup");
+ return NULL;
+ }
CHROOT_IN;
- r = mkdtemp (template);
+ r = mkdtemp (r);
CHROOT_OUT;
- if (r == NULL) {
+ if (r == NULL)
reply_with_perror ("mkdtemp: %s", template);
- return NULL;
- }...
2015 Mar 17
4
[PATCH] New API: part_get_part_type for showing partition type
...type;
+ char *part_type;
+
+ if (partnum <= 0) {
+ reply_with_error ("partition number must be >= 1");
+ return NULL;
+ }
+
+ parttype = do_part_get_parttype (device);
+ if (parttype == NULL)
+ return NULL;
+
+ if (STREQ (parttype, "gpt")) {
+ part_type = strdup("primary");
+ if (part_type == NULL) {
+ reply_with_error ("strdup failed");
+ return NULL;
+ }
+ return part_type;
+ }
+
+ /* machine parseable output by 'parted -m' did not provide
+ * partition type info.
+ * Use traditional style.
+ */
+ C...
2020 Oct 27
0
Re: [libnbd PATCH] info: Add support for new 'qemu-nbd -A' qemu:allocation-depth
...nt32_t type)
{
+ char *ret;
+
if (strcmp (metacontext, "base:allocation") == 0) {
switch (type) {
- case 0: return "allocated";
- case 1: return "hole";
- case 2: return "zero";
- case 3: return "hole,zero";
+ case 0: return strdup ("allocated");
+ case 1: return strdup ("hole");
+ case 2: return strdup ("zero");
+ case 3: return strdup ("hole,zero");
}
}
else if (strncmp (metacontext, "qemu:dirty-bitmap:", 18) == 0) {
switch (type) {
- case 0: retu...
2004 Jul 03
1
[LLVMdev] CommandLine.cpp:189: error: `strdup' undeclared
...>cygwin?
No, not yet.
>If you grab the latest CVS sources, they should work fine with
>cygwin, and will probably work better with windows in general than LLVM
>1.2.
>Again, I'm sorry that I don't know more about this and why <cstring>
>apparently doesn't have strdup, it seems really odd. If <cstring> doesn't
>work, you could try <string.h> explicitly, but it would be much better to
>use cygwin if you can.
As far as I've investigated, it seems more clear to me, that it is the SDK
of Interix that is buggy, because, if I includes free...
2004 Jul 05
0
[LLVMdev] CommandLine.cpp:189: error: `strdup' undeclared
Hi
I've found below declaration of strdup in /usr/include/string.h.
But, I'm wondering why it doesn't belong to the ordinary function prototypes
as extern char * __cdecl strcpy(char *, const char *);.
Are you able to explain below meaning to me?
#if defined(_ALL_SOURCE) \
|| (defined(_XOPEN_SOURCE) && (_XOPEN_SOU...
2004 Jul 06
1
[LLVMdev] CommandLine.cpp:189: error: `strdup' undeclared
Hi
>
>Are you able to explain below meaning to me?
>
>#if defined(_ALL_SOURCE) \
> || (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE_EXTENDED==1)) \
> || (__STDC__ - 0 == 0 && !defined(_POSIX_C_SOURCE))
>extern char* __cdecl strdup(const char *);
>#endif /* defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE_EXTENDED == 1) */
>
(RTFM) Some of the above macros and their meaning can be found in Interix'
UNIX Application Migration Guide, chapter 10. An excerpt:
"To add or isolate code that implements Interix-speci...
2010 Apr 09
2
[PATCH] gfxboot: support MENU LABEL statement
...= 0;
t = skip_spaces(t);
- if(!strcmp(s, "timeout")) {
+ if(!strcasecmp(s, "timeout")) {
timeout = atoi(t);
continue;
}
- if(!strcmp(s, "default")) {
+ if(!strcasecmp(s, "default")) {
menu_default->label = strdup(t);
u = strlen(t);
if(u > label_size) label_size = u;
continue;
}
- if(!strcmp(s, "label")) {
+ if(!strcasecmp(s, "label")) {
menu_ptr = *menu_next = calloc(1, sizeof **menu_next);
menu_next = &menu_ptr->next;...