Sponsored Content
Top Forums Programming How to avoid dangling pointers? Post 302880518 by techmonk on Friday 20th of December 2013 06:41:43 AM
Old 12-20-2013
How to avoid dangling pointers?

To get rid of dangling pointers, after freeing the pointer, can we assign NULL. Is this be an acceptable solution. Since
Code:
free(NULL)

won't do any operation.

Code:
main(){
 void *ptr = malloc(10);
 free(ptr); 
 ptr = NULL;
 free(ptr);
}

 

10 More Discussions You Might Find Interesting

1. Programming

Pointers to Arrays

Below is the program i tried to execute...... main() { static int a = {0,1,2,3,4}; static int *p = {a, a+1, a+2, a+3, a+4}; printf (“\n %u %u %d”, p, *p, *(*p) ); } This works, but i wanted to know why both a and *p are declared as "static". If we dont declare a as static... (2 Replies)
Discussion started by: Jayathirtha
2 Replies

2. Shell Programming and Scripting

functiom pointers

Hi all i wonder about function pointers as i never used them in my C code . could any tell me why and where exactly function pointers come into picture . thanq (1 Reply)
Discussion started by: Raom
1 Replies

3. Programming

pointers

is this a valid c declaration int (*ptr(int *b)); plz explain... (4 Replies)
Discussion started by: areef4u
4 Replies

4. Programming

pointers

Hi I mash with pointers in C. I solve this problem about 5 hours and I don't know how I should continue. void InsertFirst (tList *L, int val) { tElemPtr new; if((new = malloc(sizeof(tElemPtr))) == NULL) Error(); new->data = val; new->ptr = L->frst; L->frst = new;... (2 Replies)
Discussion started by: Milla
2 Replies

5. Programming

restricted pointers

Hi all. I am trying to use restricted pointers to allow the gcc compiler optimize the code, but I have not been able to make it work so far. I am testing with this code: #include <stdlib.h> #include <stdio.h> #include <time.h> #include <sys/time.h> void vecmult(int n, int * restrict a, int... (0 Replies)
Discussion started by: carl.alv
0 Replies

6. UNIX for Advanced & Expert Users

shared pointers

I am new to shared pointer conceot in C++ and hence require some clarification: For example: class A { public: virtual ~A() { } int x; }; typedef boost::shared_ptr<A>... (1 Reply)
Discussion started by: uunniixx
1 Replies

7. Programming

Need help with the Pointers in C

I have a special character called ô. When it is declared as a character variable its showing it can be printed. But when it is declared as a character pointer variable its showing it cannot be printed. I am just wondering why its happening like this.. c1 = '@'; c2 = 'ô'; char *fp; fp="XXô"; if... (1 Reply)
Discussion started by: sivakumar.rj
1 Replies

8. Programming

Problem With Pointers

Hi guys. What is the difference between these: 1. int *a; 2. int (*a); (2 Replies)
Discussion started by: majid.merkava
2 Replies

9. Programming

Pointer to pointers

Hi guys, I'm trying to understand pointers in C and made a simple example and I've problems with It. Can someone help? #include <stdio.h> #include <stdlib.h> #include <assert.h> int f1(char **str_); int main(int argc, char **argv) { char *str = NULL; f1(&str); ... (3 Replies)
Discussion started by: pharaoh
3 Replies

10. Programming

Pointers and array

Hello, I read from a book exercise for a challenge. How to print out each letter of char array a by two different pointers pa and ppa in the example? I have tried my code for letter "r" by testing without full understanding as only the first one worked. #include<stdio.h> int main() { char... (17 Replies)
Discussion started by: yifangt
17 Replies
SLAPO-MEMBEROF(5)						File Formats Manual						 SLAPO-MEMBEROF(5)

NAME
slapo-memberof - Reverse Group Membership overlay to slapd SYNOPSIS
/etc/openldap/slapd.conf DESCRIPTION
The memberof overlay to slapd(8) allows automatic reverse group membership maintenance. Any time a group entry is modified, its members are modified as appropriate in order to keep a DN-valued "is member of" attribute updated with the DN of the group. CONFIGURATION
The config directives that are specific to the memberof overlay must be prefixed by memberof-, to avoid potential conflicts with directives specific to the underlying database or to other stacked overlays. overlay memberof This directive adds the memberof overlay to the current database; see slapd.conf(5) for details. The following slapd.conf configuration options are defined for the memberof overlay. memberof-group-oc <group-oc> The value <group-oc> is the name of the objectClass that triggers the reverse group membership update. It defaults to groupOfNames. memberof-member-ad <member-ad> The value <member-ad> is the name of the attribute that contains the names of the members in the group objects; it must be DN-val- ued. It defaults to member. memberof-memberof-ad <memberof-ad> The value <memberof-ad> is the name of the attribute that contains the names of the groups an entry is member of; it must be DN-val- ued. Its contents are automatically updated by the overlay. It defaults to memberOf. memberof-dn <dn> The value <dn> contains the DN that is used as modifiersName for internal modifications performed to update the reverse group mem- bership. It defaults to the rootdn of the underlying database. memberof-dangling {ignore, drop, error} This option determines the behavior of the overlay when, during a modification, it encounters dangling references. The default is ignore, which may leave dangling references. Other options are drop, which discards those modifications that would result in dan- gling references, and error, which causes modifications that would result in dangling references to fail. memberof-dangling-error <error-code> If memberof-dangling is set to error, this configuration parameter can be used to modify the response code returned in case of vio- lation. It defaults to "constraint violation", but other implementations are known to return "no such object" instead. memberof-refint {true|FALSE} This option determines whether the overlay will try to preserve referential integrity or not. If set to TRUE, when an entry con- taining values of the "is member of" attribute is modified, the corresponding groups are modified as well. The memberof overlay may be used with any backend that provides full read-write functionality, but it is mainly intended for use with local storage backends. The maintenance operations it performs are internal to the server on which the overlay is configured and are never repli- cated. Replica servers should be configured with their own instances of the memberOf overlay if it is desired to maintain these memberOf attributes on the replicas. FILES
/etc/openldap/slapd.conf default slapd configuration file SEE ALSO
slapd.conf(5), slapd-config(5), slapd(8). The slapo-memberof(5) overlay supports dynamic configuration via back-config. ACKNOWLEDGEMENTS
This module was written in 2005 by Pierangelo Masarati for SysNet s.n.c. OpenLDAP 2.4.39 2014/01/26 SLAPO-MEMBEROF(5)
All times are GMT -4. The time now is 12:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy